Skip to content

Json deserializer ​

Parses JSON text into objects of a flow type. The target type is not configured: it is the type of the connection on the Output pin. A JSON array produces one message per element; the elements can form a batch.

Pins ​

PinKindTypesDescription
InputinputViaducta.Plugins.TextPlugin.Types.TextRecord, Viaducta.Plugins.Http.Types.WebHttpResponse, Viaducta.Plugins.Http.Types.WebHttpRequest, Viaducta.Plugins.UdpTypes.UdpDatagram, Viaducta.Plugins.Event.Types.EventDataThe JSON source: TextRecord.Value, WebHttpResponse.Body, WebHttpRequest.Body (or ByteBody as UTF-8 when Body is empty), UdpDatagram.Data (UTF-8) or EventData.Data (UTF-8).
Outputoutputtype of the output connectionOne object of the connection's type per JSON object.

Configuration ​

FieldTypeDefaultDescription
BatchModedropdown: 1 Auto, 2 Always, 3 Never1Whether the elements of a JSON array form a batch for batch consumers (Write file, Bulk insert, Build array). Auto: only if the input record is not already in a batch (Http client, events); inside a batch (e.g. a file read by Read file) the elements stay in that batch. Always: a child batch per array. Never: no batch.

Behaviour ​

  • Target type: when the flow starts, the plugin takes the type set on the output connection (for example a type you created or imported from a JSON sample/schema). Choose the type on the connection; JSON property names are matched to the type's properties.
  • JSON object (text not starting with [): deserialized into one object and emitted; no batch.
  • JSON array: deserialized into a list of the target type; each element is emitted separately. When a batch is opened (BatchMode) it ends after the last element was processed downstream: batch consumers commit then, an error that reaches the deserializer fails the batch and they roll back. The batch label is TextRecord.Name when set. An empty array emits nothing and opens no batch.
  • Record positions (First/Last) are not set.
  • No output connection: nothing is done.
  • Invalid JSON or JSON that doesn't fit the type raises an error handled by the flow's error handling.

Notes ​

  • Components that still collect by record position (Json serializer with batching, Csv encoder, ...) don't see array boundaries any more; they must use batches.
  • An empty or missing body (e.g. WebHttpResponse.Body null, EventData.Data null) raises an error naming the input type.
  • If the output pin has several connections with different types, the flow fails at start: all output connections must use the same type.
  • The JSON root must match the target type: to read { "items": [ ... ] } use a type with an items list property (or a script), not the element type.

Example ​

No configuration. Placement:

Http client → Json deserializer (output connection type Order) → Data mapper → Database writer

Http listener → Webhook receiver → Json deserializer (output connection type OrderCreated) → ...

Viaducta documentation