| The JSONObject class / util.JSONObject methods | |
Fills a record variable with the entries contained in the JSON object.
util.JSONObject.toFGL( dest RECORD )
The toFGL() method fills the RECORD variable passed as parameter with the corresponding values defined in the JSON object.
The destination record must have the same structure as the JSON source data. For more details see JSON to FGL conversion rules.
IMPORT util
MAIN
DEFINE cust_rec RECORD
cust_num INTEGER,
cust_name VARCHAR(30),
order_ids DYNAMIC ARRAY OF INTEGER
END RECORD
DEFINE js STRING
DEFINE obj util.JSONObject
LET js='{ "cust_num":2735, "cust_name":"McCarlson",
"order_ids":[234,3456,24656,34561] }'
LET obj = util.JSONObject.parse( js )
CALL obj.toFGL( cust_rec )
DISPLAY cust_rec.cust_name
DISPLAY cust_rec.order_ids[4]
END MAIN