Try OpenEdge Now
skip to main content
Working with JSON
Reading and Serializing JSON to/from ProDataSets and Temp-tables : Writing JSON from a temp-table, temp-table buffer, or a ProDataSet : Minimizing the size of JSON data : Omitting fields with initial values
 
Omitting fields with initial values
When a field is defined, it gets an initial value either by using the default initial value for the field's data type or from the INITIAL option in the definition statement or ADD-NEW-FIELD( ) method. The following table shows the default initial values for ABL data types.
Table 8. Default initial values for ABL data types
Data type
Default initial value
BLOB
Unknown value (?)
CHARACTER
Empty string ("")
CLOB
Unknown value (?)
COM-HANDLE
Unknown value (?)
DATE
Unknown value (?)
DATETIME
Unknown value (?)
DATETIME-TZ
Unknown value (?)
DECIMAL
0
HANDLE
Unknown value (?)
INT64
0
INTEGER
0
LOGICAL
No
RAW
Zero-length sequence of bytes
RECID
Unknown value (?)
ROWID
Unknown value (?)
Omitting initial value fields from your JSON can be useful if:
*Fields with initial values are not important to the business or application logic of your JSON consumer
*The JSON consumer knows how to recreate missing fields and populate them with initial values
To omit these fields, specify TRUE for the optional omit-initial-values argument of the WRITE-JSON( ) method.
When working with large ProDataSets, omitting fields containing their initial values can yield smaller JSON values, more efficient network transfers, and performance gains with the READ-JSON( ) and WRITE-JSON( ) methods.
Although using the omit-initial-values option can give your application performance and resource use improvements, you must be sure that the consumers of the generated JSON output can correctly handle it. The ABL READ-JSON( ) method always populates created records with initial values from the temp-table or ProDataSet definition. Other applications might not do this.