util.JSONArray.get()

util.JSONArray.get() returns a value of a member of the JSON array.

Syntax

CALL util.JSONArray.get(index)

Parameters

index

an index of the member of the specified JSON array

Receiving variable can be of STRING, util.JSONObject, or util.JSONArray types.

Usage and examples

util.JSONArray.get() returns a value, a JSON object or an element of the JSON object that corresponds to the index passed as the method's parameter.

If the element identified by the name is a simple value, the method will return a string:

MAIN
DEFINE json_arr util.JSONArray
LET json_arr=util.JSONArray.parse('[123,"abc"]')
DISPLAY json_arr.get(1)
DISPLAY json_arr.get(2)
CALL fgl_getkey()
END MAIN

 

If the element is structured or a part of the structured data, the method will return a util.JSONObject instance (thus, the returned instance must be assigned to a variable of the util.JSONObject type).

If the element is a list of values or a value from this list, the method will return a util.JSONArray instance (thus, the returned instance must be assigned to a variable of the util.JSONArray type).

Array members can be set with the util.JSONArray.put() method.

 

 

Contact Us

Privacy Policy

Copyright © 2025 Querix, (UK) Ltd.