The JSONObject class / util.JSONObject methods |
Parses a JSON string and creates a JSON object from it.
util.JSONObject.parse( source STRING ) RETURNING result util.JSONObject
The util.JSONObject.parse() method scans the JSON source string passed as parameter and creates a JSON object from it.
The new created object must be assigned to a program variable defined with the util.JSONObject type.
The source string must follow the JSON format specification. It can contain multi-level structured data, but it must start with a curly brace.
The method raises error -8109 if the JSON source string is not properly formatted.
IMPORT util MAIN DEFINE js STRING DEFINE obj util.JSONObject LET js='{ "cust_num":2735, "cust_name":"McCarlson", "orderids":[234,3456,24656,34561] }' LET obj = util.JSONObject.parse( js ) DISPLAY obj.get("cust_name") END MAIN