util.JSONArray.put() / util.JSONArray.insert()

util.JSONArray.put() adds a new member to the specified JSON array.

util.JSONArray.insert() adds an element to the JSON array.

Syntax

CALL util.JSONArray.put(index INTEGER, value ANY_TYPE)

CALL util.JSONArray.insert(index INTEGER, value ANY_TYPE)

Parameters

util.JSONArray.put()

index INTEGER

an index of the member of the specified JSON array

value ANY_TYPE

a value to be associated with this index

util.JSONArray.insert()

index INTEGER

an index of the element of the specified JSON array

value ANY_TYPE

a value to be associated with this index

 

Usage and examples util.JSONArray.put()

Members added by util.JSONArray.put() must be assigned to a variable of the util.JSONArray data type.

The index of the first array member is 1.

The value of the array member can be a simple string or numeric value as well as a complex value of RECORD or DYNAMIC ARRAY data type.

 

If a JSON array has a member with the specified index already, the value of member will be changed:

Array members can be returned with the util.JSONArray.get() method.

Array members can be removed with the util.JSONArray.remove() method.

Usage and examples util.JSONArray.insert()

MAIN
  DEFINE json_arr util.JSONArray

  DEFINE da DYNAMIC ARRAY OF STRING
    LET json_arr=util.JSONArray.create()
    LET json_arr = util.JSONArray.parse('["aa","bb","cc"]')
    DISPLAY json_arr.toString()
    CALL json_arr.insert(1,"new_val")
    DISPLAY json_arr.toString()
END MAIN

 

 

Contact Us

Privacy Policy

Copyright © 2025 Querix, (UK) Ltd.