The util.JSONArray class / util.JSONArray methods |
Returns the value of a JSON array element.
util.JSONArray.get( index INTEGER ) RETURNING result result-type
The get() method returns the value or JSON object corresponding to the element at the given position.
The index corresponding to the first element is 1.If no element exists at the given index, the method returns NULL.
If the element identified by the name is a simple value, the method returns a string. If the element is structured, the method returns a util.JSONObject instance and the returned object must be assigned to a program variable defined with the util.JSONObject type. If the element is a list of values, the method a util.JSONArray instance and the returned object must be assigned to a program variable defined with the util.JSONArray type.
A name/value pair can be set with the put() method.
IMPORT util MAIN DEFINE arr util.JSONArray LET arr = util.JSONArray.parse('[123,"abc",null]') DISPLAY arr.get(2) -- abc END MAIN