util.JSONArray.fromFGL

Creates a new JSON array object from a DYNAMIC ARRAY.

Syntax

util.JSONArray.fromFGL(
   source DYNAMIC ARRAY )
  RETURNING array util.JSONArray
  1. source is the DYNAMIC ARRAY variable used to create the JSON array object.

Usage

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

The new 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 FGL to JSON conversion rules.

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