JSON
Using the JSON option, you can choose the case of the names in the JSON text generated by the JSONPUT built-in functions and expected by the JSONGET built-in functions.
- CASE(UPPER | LOWER | ASIS)
- Under the CASE(UPPER) suboption, the names in the JSON text generated
by the JSONPUT built-in functions and expected by the JSONGET built-in
functions will all be in upper case.
Under the CASE(LOWER) suboption, the names in the JSON text generated by the JSONPUT built-in functions and expected by the JSONGET built-in functions will all be in lower case.
Under the CASE(ASIS) suboption, the names in the JSON text generated by the JSONPUT built-in functions and expected by the JSONGET built-in functions will be in the case used in their declares. Note that if you use the MACRO preprocessor without using the macro preprocessor option CASE(ASIS), the source seen by the compiler will have all the names in upper case, which makes specifying the JSON(CASE(ASIS)) option useless.
The default is CASE(UPPER).
- ENCODING(UTF8 | EBCDIC | 37 | 1047)
-
Under the ENCODING(UTF8) suboption, the code page of the JSON text in JSONPUT and JSONGET functions is UTF-8. This is the default suboption and the only valid choice for standard-conforming JSON.
Under the ENCODING(EBCDIC) suboption, the code page of the JSON text in JSONPUT and JSONGET functions is the same as specified in the CODEPAGE compiler option. This suboption is valid only if the CODEPAGE option specifies an EBCDIC code page.
Under the ENCODING(37) suboption, the code page of the JSON text in JSONPUT and JSONGET functions is 37. This suboption is valid only if the CODEPAGE option specifies code page 1047.
Under the ENCODING(1047) suboption, the code page of the JSON text in JSONPUT and JSONGET functions is 1047. This suboption is valid only if the CODEPAGE option specifies code page 37.
- GET(HEEDCASE | IGNORECASE)
- Under the GET(HEEDCASE) suboption, the JSONGET built-in functions will demand exactly matching
names.
Under the GET(IGNORECASE) suboption, the JSONGET built-in functions will view names as matching if their case is ignored.
The default is GET(HEEDCASE).
- PARSE(V1 | V2)
-
Under the option JSON(PARSE(V1)):
-
If the JSON source specifies more values for an array than in the target declaration, then the ERROR condition will be raised (reporting that a closing bracket
]was not found when expected) -
If the third argument is a structure, then the names in the JSON text must match those in the structure. If not, the ERROR condition is raised.
Note: Under this option, it is not necessary to specify name-value pairs for all the elements in the structure, but any names specified must be in the same order as they are in the structure.Under the compiler option JSON(PARSE(V2)):- If the JSON source specifies more values for an array than in the target
declaration:
- If SUBSCRIPTRANGE is enabled, then the SUBSCRIPTRANGE condition will be raised
- Otherwise, the excess values will be ignored
- If the third argument is a structure and a name in the JSON text does not match any
name in the structure:
- If CONFORMANCE is enabled, then the CONFORMANCE condition will be raised and the ONJSONNAME built-in function will return the unmatched name
- Otherwise, the name and its JSON-value will be ignored
- The JSON null will be accepted as a value for structures and arrays.
Note: Under this option, it is not necessary to specify name-value pairs for all the elements in the structure, and it is not necessary that the names are specified in the same order as they are in the structure.The default is PARSE(V1).
-
- TRIMR | NOTRIMR
-
Under the JSON( TRIMR ) option, output from the JSONPUTVALUE and JSONPUTMEMBER functions will be trimmed from the right.
Under the JSON( NOTRIMR ) option, output from the JSONPUTVALUE and JSONPUTMEMBER functions will not be trimmed from the right.
If the JSONTRIMR attribute is specified for a field in a structure, that attribute will override the JSON(NOTRIMR) option for that field.
The default is TRIMR.
