35 lines
886 B
Plaintext
35 lines
886 B
Plaintext
/* using a longchar to read and write to, can also be file, memptr, stream */
|
|
DEFINE VARIABLE lcjson AS LONGCHAR NO-UNDO.
|
|
|
|
/* temp-table defines object, can also be dataset */
|
|
DEFINE TEMP-TABLE example
|
|
FIELD blue AS INTEGER EXTENT 2
|
|
FIELD ocean AS CHARACTER
|
|
.
|
|
CREATE example.
|
|
ASSIGN
|
|
example.blue [1] = 1
|
|
example.blue [2] = 2
|
|
example.ocean = "water"
|
|
.
|
|
/* write-json to put result in lcjson, true indicates formatted */
|
|
TEMP-TABLE example:DEFAULT-BUFFER-HANDLE:WRITE-JSON( "LONGCHAR", lcjson, TRUE ).
|
|
|
|
/* display result */
|
|
MESSAGE
|
|
STRING( lcjson )
|
|
VIEW-AS ALERT-BOX.
|
|
|
|
/* empty results */
|
|
EMPTY TEMP-TABLE example.
|
|
|
|
/* read-json to get result from lcjson */
|
|
TEMP-TABLE example:DEFAULT-BUFFER-HANDLE:READ-JSON( "LONGCHAR", lcjson ).
|
|
|
|
FIND example.
|
|
/* display results */
|
|
MESSAGE
|
|
example.blue [1] example.blue [2] SKIP
|
|
example.ocean
|
|
VIEW-AS ALERT-BOX.
|