util.JSONArray.fromFGL() creates a new JSON array from a DYNAMIC ARRAY.
Syntax
CALL util.JSONArray.fromFGL(source)
Parameters
source |
a DYNAMIC ARRAY variable from that the JSON array is created |
Usage and examples
util.JSONArray.fromFGL() converts the members of the DYNAMIC ARRAY into the members of the JSON array.
An array newly created by util.JSONArray.fromFGL() must be assigned to a variable of the util.JSONArray datatype.
MAIN
DEFINE da DYNAMIC ARRAY OF INTEGER
DEFINE json_arr util.JSONArray
LET da[1] =1
LET da[2] =12
LET da[3] =123
LET json_arr=util.JSONArray.fromFGL(da)
DISPLAY
json_arr.toString()
CALL fgl_getkey()
END MAIN
Dynamic arrays can be structured with a RECORD definition: In this case, array members will be converted individually.
More details about how fgl data types are converted into JSON strings are here.