util.JSONObject.getLength
Returns the number of name-value pairs in the JSON object.
Syntax
util.JSONObject.getLength()
RETURNS INTEGER
Usage
The getLength()
method returns the number of name-value
pairs in the JSON object.
This method can be used along with the name()
and
getType()
methods to read the entries of a JSON object.
Example
IMPORT util
MAIN
DEFINE obj util.JSONObject
DEFINE i INTEGER
LET obj = util.JSONObject.parse('{"id":123,"name":"Scott"}')
FOR i=1 TO obj.getLength()
DISPLAY i, ": ", obj.name(i), "=", obj.get(obj.name(i))
END FOR
END MAIN
Output:
1: id= 123.0
2: name=Scott