Appearance
Json serializer
Converts the input object to JSON text. The records of a batch (e.g. one Sql query execution, one JSON array from Json deserializer, one file read) are serialized together into one JSON array when the batch completes; records without a batch become one JSON object each.
Pins
| Pin | Kind | Types | Description |
|---|---|---|---|
| Input | input | any | The object(s) to serialize. |
| Output | output | Viaducta.Plugins.TextPlugin.Types.TextRecord | The JSON in Value, ContentType = application/json (Name is not set). |
Configuration
| Field | Type | Default | Description |
|---|---|---|---|
Indented | boolean | true | Pretty-printed (true) or compact (false) JSON. |
IgnoreInternalFields | boolean | true | Leaves out the internal recordId field. |
SkipValidation | boolean | false | Not used (see Notes). |
BatchScope | batch scope selector | empty | Which batch is serialized into one JSON. Empty = the closest batch producer upstream. A component id of a batch producer upstream = the batches of that producer. None = ignore batches. |
MaxDepth | integer 0-1000 | 0 | Maximum nesting depth; 0 means the default (64 in .NET). |
DefaultIgnoreCondition | dropdown: 0 Never, 1 Always, 2 WhenWritingDefault, 3 WhenWritingNull | 0 | Which property values are left out: 3 skips nulls, 2 skips nulls and default values (0, false, ...). |
Behaviour | dropdown: 0 None, 1 AlwaysSerializeArray | 0 | 1: empty input (NoInputData) gives [], and a batch with one record gives a one-element array. |
Behaviour
- Records in a batch (see
BatchScope) are collected per batch. When the whole batch has been processed they are serialized and emitted as oneTextRecord: a JSON array, or a JSON object when the batch has a single record (an array withBehaviour=1). The record carries the metadata of the last record and stays in the batch, so batch consumers behind it (Write file, ...) include it before they commit. When the batch failed nothing is emitted. Concurrent batches never mix. - Records without a batch, or
BatchScopeNone: oneTextRecordper input, containing a JSON object (or[]forNoInputDatawithBehaviour=1).
Notes
- A batch is emitted only after the whole batch was processed: the JSON of a large batch is built in memory.
SkipValidationis ignored by the code.DefaultIgnoreCondition=1(Always) is not accepted by the .NET serializer and makes serialization fail.MaxDepthdescription in the designer says 0 means 1000; the .NET default for 0 is 64.
Example
json
{ "Indented": false, "DefaultIgnoreCondition": 3, "Behaviour": 1 }Timer → Sql query → Json serializer → Write file (one JSON file per query execution)