Extension packages / The util package |
Describes how FGL data is converted to JSON data.
The JSON utility classes implement methods that can convert an FGL RECORD or DYNAMIC ARRAY to a JSON data string. This topic describes how FGL data is converted to JSON data.
To name the JSON elements, the names of the record members are used as defined in the program source. Since JSON is case-sensitive, make sure the names of the FGL record members match exactly the names expected in the resulting JSON data string: CustNo will be different from custNo.
If a record member is NULL, then this member will be omitted in the resulting JSON string or object.
Program array members in the record are converted to JSON arrays delimited by square brackets ([]).
Target FGL type | Description |
---|---|
BOOLEAN | Will be serialized with the JSON values true or false. |
TINYINT, SMALLINT, INTEGER, BIGINT, SMALLFLOAT, FLOAT, DECIMAL, MONEY | Any numeric type will be serialized to this form: an optional minus sign (-), a sequence of digits (0-9), containing a optional decimal separator (.), followed by an optional exponent. The exponent has the form (e) followed by an optional minus sign and an sequence of digits. The representation of numeric values does not depend from the current locale. The decimal separator is always a dot (.). MONEY values will be represented like DECIMAL values: the currency symbol will be omitted. |
DATE | The date value will be formatted as "YYYY-MM-DD" (with double quotes) |
DATETIME | The datetime value will be formatted as "YYYY-MM-DD hh:mm:ss.fffff" (with double quotes), according to the datetime type definition. |
INTERVAL | The interval value will be formated as "YYYY-MM" or "DD hh:mm:ss.fffff" (with double quotes), according to the interval type definition. |
BYTE | Will be serialized to a base64 encoded double quoted string. The base64 encoding is described in [RFC4648]. |
TEXT, CHAR, VARCHAR, STRING | Character string data will be serialized
as a double quoted string with backslash escaping. List
of characters requiring escaping:
\\ backslash U+005C \" quotaion 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 |
Other | Any other type will be serialized as a double quoted (") string. |