JSON_ObjectSetArray
%JSON_ObjectSetArray function
Function
Adds a name-array pair into the JSON object
Declaration
%JSON_ObjectSetArray(
INT in handle,
TEXT in field,
INT in array
)Parameters
handle | Handle to parent JSON object. |
field | Field name |
array | Handle to JSON array |
Return value
None
Description
Function adds a name-array pair into the JSON object. If fthe ield already exists, value is updated.
Exception is thrown if handle to parent JSON object or JSON array is invalid or field does not exists.
The array is not copied – the handle and the item in the parent object point to the same array. See Sharing of arrays.
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)