JSON to BDL type conversion rules
Specific type conversion rules apply when parsing a JSON string to fill a BDL variable.
JSON source string | Target Genero BDL type |
---|---|
A JSON object in the
form:
|
RECORD ... END RECORD |
A JSON array in the
form:
|
DYNAMIC ARRAY OF ... |
A JSON object in the
form:
|
DICTIONARY OF ... |
A JSON value can be If the JSON value is a number or a string, the language conversion rules from number/string to
|
BOOLEAN |
A JSON number. The JSON number can be assigned to any language numeric type. The limits of the target type cause
potential overflows errors. On error the target variable will be initialized to
|
TINYINT , SMALLINT ,
INTEGER , BIGINT , SMALLFLOAT ,
FLOAT , DECIMAL , MONEY |
A JSON string representing a date in the form |
DATE |
A JSON string representing a datetime or a JSON number. If the value is a JSON string, it must be formatted as If the value is a JSON number, it is interpreted as UNIX™ time (seconds since the Epoch 00:00:00 UTC, January 1, 1970). Note that the Note: The
util.JSON parser also supports Microsoft JSON AJAX old-style datetime
values:
\/Date(nnn ,
where nnn is a number of milliseconds since epoch, Z indicates
UTC and +/-hhmm defines a timezone offset. Note that in the JSON
representation of the AJAX date value, backslashes need to be escaped:
"\\/Date(76523465)\\/" . |
DATETIME YEAR TO FRACTION(n) ,
DATETIME YEAR TO SECOND , DATETIME YEAR TO MINUTE , DATETIME
YEAR TO HOUR |
A JSON string representing a year-month interval formatted as " |
INTERVAL YEAR TO MONTH , TERVAL YEAR TO
YEAR |
A JSON string representing a day-second interval formatted as
"DD hh:mm:ss.fffff ". |
INTERVAL DAY TO FRACTION(n) ,
INTERVAL DAY TO SECOND , INTERVAL DAY TO MINUTE , INTERVAL
DAY TO HOUR |
A JSON string value encoded in Base64. The Base64 encoding is described in [RFC4648]. |
BYTE (see note) |
A JSON string or number. If the JSON value is a number, the resulting BDL string value uses the locale specific decimal point. If the JSON value is a string: Any character in the Basic Multilingual Plane (U+0000 through
U+FFFF) may be escaped: |
TEXT (see note), CHAR ,
VARCHAR , STRING |
TEXT
or
BYTE
variable, if the data storage for the LOB variable has not been defined with
the LOCATE
instruction, the JSON
methods will automatically locate the TEXT
or BYTE
in memory. This
applies also to TEXT
and BYTE
elements of records, arrays and
dictionaries.