Convert data to JSON

Supported in: Batch, Streaming

Transforms input into json string.

Expression categories: File, String

Declared arguments

  • Input - Input to be transformed.
    Expression<Array<AnyType> | Map<AnyType, AnyType> | Struct>

Output type: String

Examples

Example 1: Base case

Argument values:

  • Input: array
arrayOutput
[ hello, world ]["hello","world"]

Example 2: Base case

Argument values:

  • Input: struct
structOutput
{
airline: {
id: NA,
},
}
{"airline":{"id":"NA"}}

Example 3: Base case

Argument values:

  • Input: struct_0
struct_0Output
{
date: 2021-01-01,
dec32: 1.12,
dec33: 0.120,
 **dec...
{"dec32":1.12,"dec33":0.120,"dec64":10.0000,"timestamp":"2021-01-01T01:01:01.000Z","date":"2021-01-01","struct_1":{"airline":{"id":"NA"}}}

Example 4: Base case

Argument values:

  • Input: array
arrayOutput
[ 1.00, 2.10, 36.00 ][1.00,2.10,36.00]

Example 5: Base case

Argument values:

  • Input: map
mapOutput
{
 a -> 1,
 b -> 2,
}
{"a":"1","b":"2"}

Example 6: Base case

Argument values:

  • Input: array
arrayOutput
[ {
airline: {
id: NA,
},
}, null ]
[{"airline":{"id":"NA"}},null]

Example 7: Base case

Argument values:

  • Input: map
mapOutput
{
 a -> {
airline: {
id: NA,
},
},
}
{"a":{"airline":{"id":"NA"}}}

Example 8: Base case

Argument values:

  • Input: struct_0
struct_0Output
{
array_1: [ null, null, null ],
struct_1: {
double: null,
string: null,
},
}
{"struct_1":{"string","double"},"array_1":[null,null,null]}
{
array_1: null,
struct_1: null,
}
{"struct_1","array_1"}