util.JSONObject.name
Returns the name of a JSON object entry by position.
Syntax
util.JSONObject.name(
index INTEGER )
RETURNS STRING
- index is the index of the name-value pair in the JSON object.
Usage
The name()
method returns the entry name in the JSON object at the
given position.
The index corresponding to the first name-value pair is 1.
If no entry exists at the given index, the method returns NULL
.
This method can be used along with the getLength()
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)
END FOR
END MAIN