Certain rules are applied when 4gl variable are converted to/from JSON.
Original 4GL datatype |
Resulting JSON string |
a util.JSONObject in this form: { "record-element-name" : json-value [,...] } |
|
a util.JSONArray in this form: [ json-value [,...] ] |
|
a JSON |
|
a sequence of characters in this form: -{0..9}.exponent Above and below, these are regular items, and these are optional ones Exponents get this form: e-{0..9} Representation of numeric values does not depend on the current locale. MONEY values are represented as DECIMAL values. Currency symbol is omitted. Decimal separator is always . (dot) and never , (comma). |
|
is formatted as |
|
a Base64-encoded double-quoted string |
|
a double-quoted string with backslash escaping (if necessary) These characters require escaping: \\ backslash, U+005C \" quotation mark, U+0022 \b backspace, U+0008 \f form feed, U+000C \n line feed, U+000A \r carriage return, U+000D \t tab, U+0009 |
Values of any other datatype are converted to a double-quoted string.
Original JSON string |
Resulting 4GL datatype |
util.JSONObject in this form: { "record-element-name" : json-value [,...] } |
|
util.JSONArray in this form: [ json-value [,...] ] |
|
JSON If the JSON value is a number or a string, the rules are applied for converting number/string to BOOLEAN |
|
JSON number JSON numbers can be converted to a value of any numeric datatype. Overflows errors may occur because of the limits of the target datatype. If any error occurs, the target variable will be initialized to NULL, and the parser will continue without errors. |
|
JSON string formatted as |
|
JSON string representing a datetime or a JSON number If the value is a JSON string, it must
If the value is a JSON number, it is interpreted as the UNIX™ time (in seconds since Unix epoch).
When exchanging datetime values across different time zones, we recommend converting datetime values to Coordinated Universal Time (UTC) by the util.Datetime methods. |
|
JSON string formatted as |
|
JSON string encoded in Base64 |
|
JSON string or number For JSON numbers, the resulting 4GL string will use the locale-specific decimal point. For JSON strings,
|