Extension packages / The util package |
Provides an interface to handle a JSON object.
The util.JSONObject class provides methods to handle an structured data object following the JSON string syntax.
JSON (JavaScriptâ„¢ Object Notation) is a well known lightweight data-interchange format for JavaScript. For more details, see http://www.json.org. A JSON string (or object) is a comma-separated list of name:value pairs with the ':' character separating the key and the value. The list is enclosed in curly braces ({,}). The names are double-quoted strings.
IMPORT util
{ "cust_num":2735, "cust_name":"McCarlson", "order_ids":[234,3456,24656,34561] }
The JSONObject class provides methods for accessing, adding/replacing or deleting the values by name with the get(), put() and remove() methods. If the structure of the JSON object is not known at compile time, you can introspect the elements of the object with the getLength(), getType() and name() methods.
A JSONObject object must be created before usage with one of the class methods like util.JSONObject.create().