util.JSONArray.getLength()

 

util.JSONArray.getLength() returns the number of the members included in the specified JSON array.

 

Syntax:

 

util.JSONArray.getLength()

 

Usage and examples:

 

util.JSONArray.get() is used to return or display how many members there are in the specified JSON array.

 

example code #1

MAIN

  DEFINE json_arr util.JSONArray

    LET json_arr = util.JSONArray.parse('[123,"abc",null]')

    DISPLAY json_arr.getLength()

  CALL fgl_getkey()

END MAIN

 

obtained results #1

 

example code #2

 

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 da[4] = 1234

      LET da[5] = 12345

      LET json_arr = util.JSONArray.fromFGL(da)

    DISPLAY json_arr.getLength()

  CALL fgl_getkey()

END MAIN

 

obtained results #2

 

 

This method can be used together with util.JSONArray.getType()  in order to read the members of JSON arrays:

 

 

 

Example programs:

CVS server: client.querix.com

CVS repository: /lycia_doc_examples

User: client

Project: auxiliary_features/json

Program: util_JSONArray_getLength

 

Related articles:

util.JSONArray.getType()