util.JSONObject class is used to modify and manipulate structured data objects according to the syntax of JSON string.
JSON object is an unordered collection of name:value pairs:
{
"cust_num":2735,
"cust_name":"McCarlson",
"order_ids":[234,3456,24656,34561],
"address": {
"street":"34, Sunset Bld",
"city":"Los Angeles",
"state":"CA"
}
}
JSON objects are enclosed in braces - { to begin the object and } to end it. Every name is followed by : (colon) and is separated from another one by , (comma):
JSON objects are created by util.JSONObject.create().
Once created, JSON objects can be studied and manipulated by util.JSONObject methods summarized in this table.
creates a new JSON object |
|
creates a new JSON object from a RECORD |
|
parses a JSON string into a new JSON object |
|
returns a value that corresponds to the specified entry name |
|
returns the number of the key:value pairs in the JSON object |
|
returns the type of the element of the JSON object |
|
checks whether the JSON object includes the element with the name |
|
returns the key of the key:value pair by its index |
|
returns a key list of a members of the JSON object |
|
adds an element to the JSON object (= a key:value pair) |
|
removes the specified element from the JSON object |
|
deletes the specified element from the JSON object by its index |
|
fills a RECORD with the elements of the JSON object |
|
produces a JSON string from the values included into the JSON object |