%JSON_ObjectSetArray function


Function

Add name-array pair into JSON object

Declaration


%JSON_ObjectSetArray(
    INT in handle, 
    TEXT in field,
    INT in array
 )


Parameters


handleHandle to parent JSON object.
fieldField name
arrayHandle to JSON array


Return value

None

Description

Function adds name-array pair into JSON object. If field already exists, value is updated.

Exception is thrown if handle to parent JSON object or JSON array is invalid or field does not exists.

Example


 INT _obj
 _obj := %JSON_CreateObject()

 INT _arr
 _arr := %JSON_CreateArray()
 
 %JSON_ArrayAppendValue(_arr, 3.1416)
 %JSON_ObjectSetArray(_obj, "Constants", _arr)

 %JSON_FreeObjectHandle(_obj)
 %JSON_FreeArrayHandle(_arr)