Omit the outer object in JSON data
- Last Updated: January 17, 2024
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
When writing JSON data using the WRITE-JSON( ) method, an optional LOGICAL
expression, omit-outer-object, indicates whether the
outer-most object is included in the JSON output. TRUE
directs the AVM to remove the outer-most object on output, and FALSE directs the AVM to include the outer-most object in the output.
When writing a JSON string or JsonObject target, the
default value is FALSE. If you specify the Unknown value
(?), WRITE-JSON( ) also
uses the default value of FALSE. When writing a temp-table to
a JsonObject target, omit-outer-object
must be FALSE. If you specify TRUE,
WRITE-JSON( ) generates an error message and returns FALSE.
When writing a JsonArray target, the
default value is TRUE. If you specify the Unknown value (?), WRITE-JSON( ) also uses the
default value of TRUE. When writing a temp-table or temp-table buffer object
to a JsonArray target, omit-outer-object
must be TRUE. If you specify FALSE, WRITE-JSON( ) generates an error message
and returns FALSE.
The following examples demonstrate the difference between the value of
TRUE and FALSE for omit-outer-object when writing a JSON string on a temp-table or temp-table buffer
object handle.
|
The above values are generated when the omit-outer-object is FALSE.
|
The above values are generated when the omit-outer-object is TRUE.
The following examples demonstrates the difference between the value of
TRUE and FALSE for omit-outer-object when writing a JSON string on a ProDataSet object handle.
|
The above values are generated when the omit-outer-object is FALSE.
|
For the same ProDataSet, the above values are generated when the omit-outer-object is TRUE.