The util.JSONArray class

The util.JSONArray class provides methods to handle an array of values, following the JSON string syntax.

The util.JSONArray class is provided in the util C-Extension library. To use the util.JSONArray class, you must import the util package in your program:
IMPORT util
A JSONArray is an sequence of unnamed values. The format of a JSON array string is a list of values wrapped in square brakets with commas between the values:
[123,546,"abc","def","xyz"]

A JSONArray object must be created before usage with one of the class methods like util.JSONArray.create().

The JSONArray class provides methods for accessing, adding/replacing or deleting the array values by index with the get(), put() and remove() methods.

If the structure of the JSON array is not known at compile time, you can introspect the elements of the array with the getLength() and getType() methods.