util.JSONObject.getLength

Returns the number of name-value pairs in the JSON object.

Syntax

util.JSONObject.getLength()
  RETURNING len INTEGER

Usage

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