Try OpenEdge Now
skip to main content
Working with JSON
Reading and Serializing JSON to/from ProDataSets and Temp-tables : ABL support for JSON : Methods and attributes
 

Methods and attributes

To use the JSON read and write features described in this chapter, use the handle to a temp-table, temp-table buffer, or ProDataSet to access methods and attributes of the object. The following table describes the available methods.
Table 4. JSON methods for temp-tables and ProDataSets
Method
Description
READ-JSON( )
Reads a specified JSON string, JsonArray object, or JsonObject object into a corresponding ProDataSet, a temp-table, or a temp-table buffer object.
WRITE-JSON( )
Writes a specified JSON string, JsonArray object, or JsonObject object from a corresponding ProDataSet, a temp-table, or a temp-table buffer object. In the case of the temp-table buffer object, all the records of the temp-table associated with the buffer object are written to the JSON string, JsonArray object, or JsonObject object—not just the one record in the buffer.
SERIALIZE-ROW ( )
Serializes a temp-table buffer's current row either to a JSON or XML string or to a JsonObject object.
The following table describes the JSON related attributes.
Table 5. JSON related attributes for temp-tables and ProDataSets
Attribute
Data type
Applies to
Description
FOREIGN-KEY-HIDDEN1 (Readable and writeable)
LOGICAL
Data-relation
Specifies whether the WRITE-JSON( ) method should hide foreign key fields in the child records of a nested data-relation in a ProDataSet.
NESTED
(Readable and writeable)
LOGICAL
Data-relation
Specifies whether the AVM embeds child rows within a parent row in the JSON. This affects both the data and schema.
SERIALIZE-HIDDEN
(Readable and writeable)
LOGICAL
Buffer-field
Indicates whether this field is written when the temp-table is serialized, for example into JSON or XML. This attribute als interacts with the XML-NODE-TYPE attribute.
SERIALIZE-NAME
(Readable and writeable)
CHARACTER
ProDataSet temp-table temp-table buffer temp-table buffer field
Optionally specifies the name of a ProDataSet, a temp-table, a temp-table buffer, or a temp-table buffer-field object as it should appear when serialized, for example into JSON or XML. This attribute also interacts with the XML-NODE-NAME attribute.

1 See Minimizingthe size of JSON data for more information.

Note: The SERIALIZE-HIDDEN and SERIALIZE-NAME attributes provide generalized support for serializing data objects to either JSON or XML. These attributes interact with the XML-specific attributes in ABL. For more information, see the descriptions of these attributes in OpenEdge Development: ABL Reference.