util.JSONArray.fromFGL()

 

util.JSONArray.fromFGL()creates a new JSON array from a DYNAMIC ARRAY.

 

Syntax:

 

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 data type.

 

example code

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

 

obtained results

 

Dynamic arrays can be structured with a RECORD definition: In this case, array members will be converted individually.

 

For greater details on how fgl data types are converted into JSON strings, refer here.

 

 

Example programs:

CVS server: client.querix.com

CVS repository: /lycia_doc_examples

User: client

Project: auxiliary_features/json

Program: util_JSONObject_fromFGL

 

Related articles:

util.JSONArray.create()

util.JSONObject.parse()