Uses the data from a ProDataSet, temp-table, or buffer handle to generate a JsonObject. The current contents of the JsonObject are removed.
Return type: LOGICAL
Access: PUBLIC
Applies to: Progress.Json.ObjectModel.JsonObject class
Read( INPUT DATASET-HANDLE pds-handle ) Read( INPUT DATASET-HANDLE pds-handle, INPUT omit-initial-values AS LOGICAL ) Read( INPUT DATASET-HANDLE pds-handle, INPUT omit-initial-values AS LOGICAL, INPUT read-before-image AS LOGICAL) Read( INPUT TABLE-HANDLE tt-handle ) Read( INPUT TABLE-HANDLE tt-handle, INPUT omit-initial-values AS LOGICAL ) Read( INPUT buffer-handle AS HANDLE ) Read( INPUT buffer-handle AS HANDLE, INPUT omit-initial-values AS LOGICAL ) |
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 JsonObject( ) constructor.
This behavior applies both to temp-table fields that have the default initial value for its data type, and for fields that have an initial value set with the ABL INITIAL option. When a temp-table handle is passed to JsonObject:Read( ), the JsonObject is set to a single property.
The following example shows a temp-table definition passed to JsonObject:Read( ):
DEFINE VARIABLE httCust AS HANDLE NO-UNDO. DEFINE VARIABLE myObj AS JsonObject NO-UNDO. DEFINE VARIABLE myLongchar AS LONGCHAR NO-UNDO. DEFINE TEMP-TABLE ttCust FIELD CustNum AS INTEGER FIELD Name AS CHARACTER FIELD NewCust AS LOGICAL. /* . . Load temp-table . */ httCust = TEMP-TABLE ttCust:HANDLE. myObj = NEW JsonObject(). myObj:Read(TABLE-HANDLE httCust). myObj:Write(myLongchar, TRUE). |
The following is the resultant JSON construct tree, myLongchar: