util.JSONObject.get

Returns the value corresponding to the specified entry name.

Syntax

util.JSONObject.get(
   name STRING )
  RETURNING result result-type
  1. name is the string identifying the JSON object property.
  2. result-type can be a simple type, a util.JSONObject or a util.JSONArray object reference.

Usage

The get() method returns the value or JSON object corresponding to the element name passed as parameter.

If the element identified by the name is a simple value, the method returns a string. If the element is structured, the method returns a util.JSONObject instance and the returned object must be assigned to a program variable defined with the util.JSONObject type. If the element is a list of values, the method a util.JSONArray instance and the returned object must be assigned to a program variable defined with the util.JSONArray type.

A name/value pair can be set with the put() method.

IMPORT util
MAIN
    DEFINE obj util.JSONObject
    LET obj = util.JSONObject.create()
    CALL obj.put("address", "5 Brando Street")
    DISPLAY obj.get("address")
END MAIN