When reading a JSON message, the parser builds a message tree from the input bit stream by mapping JSON values to corresponding message tree element types. When serializing a message tree into the output bit stream, tree element types are mapped to JSON value types.
The JSON parser maps JSON values to message tree element types according to the rules in the following table:
JSON value present in bit stream | Parsed as |
---|---|
String | CHARACTER |
JSON Number value presented as:
|
INTEGER |
JSON Number value presented as:
|
FLOAT |
Boolean | BOOLEAN |
Null | NULL |
The JSON serializer maps message tree elements to JSON value types according to the rules in the following table:
Message tree Element type | JSON Domain serializes as | |
---|---|---|
JSON type | Format | |
BIT | String | Any number of 0 and 1s |
BLOB | String | Even number of hexadecimal digits |
CHARACTER | String | Char data with JSON string escaping for the characters that are listed below:
|
DATE | String | The standard ESQL string representation, 'yyyy-mm-dd' |
TIME, GMTTIME | String | The standard ESQL string representation, 'hh:mm:ss.ffffff' |
INTEGER | Number |
|
FLOAT | Number |
|
DECIMAL | Number |
Decimal literals ‘NAN', ‘INF', and so on, are not supported when serializing to JSON. |
BOOLEAN | Boolean | true or false The serializer only serializes Boolean logical tree elements with true or false values; unknown is not supported |
NULL | Null | Null |
ROW | Object | Note: Assigning a ROW directly to a JSON Domain tree does not produce JSON arrays.
Produces the following JSON bit stream
|
ROW | Array | To produce a JSON array from a ROW type the JSON.Array field would also be set.
Produces the following JSON bit stream
|