The util.JSONObject class / util.JSONObject methods |
Returns the number of name-value pairs in the JSON object.
util.JSONObject.getLength() RETURNING len INTEGER
The getLength() method returns the number of name-value pairs in the JSON object.
This method can be used in conjunction with the name() and getType() methods to read the entries of a JSON object.
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