util.JSONArray.parse

Parses a JSON string and creates a JSON array object from it.

Syntax

util.JSONArray.parse(
   source STRING )
  RETURNING result util.JSONArray
  1. source is a string value that contains JSON formatted data as a list of elements delimited by square braces.

Usage

The util.JSONArray.parse() method scans the JSON source string passed as parameter and creates a new JSON array object from it.

The new created object must be assigned to a program variable defined with the util.JSONArray type.

The source string must follow the JSON format specification. Elements of the list can contain multi-level structured data, but the string must follow the JSON array string syntax '[ element, ... ]' with square braces.

The method raises error -8109 if the JSON source string is not properly formatted.

Example

IMPORT util
MAIN
    DEFINE da DYNAMIC ARRAY OF INTEGER
    DEFINE arr util.JSONArray
    LET arr = util.JSONArray.parse("[1,2,3,4,5]")
    DISPLAY arr.toString()
END MAIN