util.JSONArray.fromFGL

Creates a new JSON array object from a DYNAMIC ARRAY.

Syntax

util.JSONArray.fromFGL(
   array dynamic-array-type )
  RETURNS util.JSONArray
  1. array is the dynamic array variable used to create the JSON array object.
  2. dynamic-array-type is a DYNAMIC ARRAY OF ... type.

Usage

The util.JSONArray.fromFGL() method creates a new JSON array from the DYNAMIC ARRAY variable passed as parameter.

The created object must be assigned to a program variable defined with the util.JSONArray type.

The members of the DYNAMIC ARRAY are converted to a list of name / value pairs in the JSON array object.

The dynamic array can be structured with a RECORD definition: the elements of the array will be converted individually.

For more details about FGL to JSON conversion, see JSON support.

Example

IMPORT util
MAIN
    DEFINE da DYNAMIC ARRAY OF INTEGER
    DEFINE arr util.JSONArray
    LET da[1] = 123
    LET da[2] = 972
    LET arr = util.JSONArray.fromFGL(da)
    DISPLAY arr.toString()
END MAIN