util.JSONArray.parse() parses a JSON string into a new JSON array.
Syntax
CALL util.JSONArray.parse(source)
Parameters
source |
a JSON string from which the JSON array is created |
Usage and examples
util.JSONObject.parse() scans the JSON data string passed as the parameter, separates the pieces of the string that correspond to the structure of a JSON array, and creates a new JSON array.
An object newly created by util.JSONArray.parse() must be assigned to a variable of the util.JSONArray datatype.
MAIN
DEFINE json_arr util.JSONArray
LET json_arr=util.JSONArray.parse("[1, 2, 3, 4, 5]")
DISPLAY json_arr.toString()
CALL fgl_getkey()
END MAIN
MAIN
DEFINE json_arr util.JSONArray
LET json_arr=util.JSONArray.parse("[1, 2, 3, 4, 5]")
DISPLAY json_arr.toString()
LET json_arr=util.JSONArray.parse("[1.1, 12.21, 123.321]")
DISPLAY json_arr.toString()
LET json_arr=util.JSONArray.parse('["abc", "aabbcc", "aaabbbccc"]')
DISPLAY json_arr.toString()
LET json_arr=util.JSONArray.parse("[true,
false, null]")
DISPLAY json_arr.toString()
CALL fgl_getkey()
END MAIN
If the JSON string is not properly formatted, the -8109 error - Verify the input string passed to the JSON parsing function. See the description for more details - is returned to the user.