JSON: Difference between revisions

943 bytes added ,  12 years ago
added OpenEdge solution
(added OpenEdge solution)
Line 235:
print_endline (Json_io.string_of_json j);</lang>
 
=={{header|OpenEdge/Progress}}==
<lang progress>/* 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.</lang>
 
=={{header|Oz}}==
73

edits