%JSON_ObjectSetObject function


Function

Adds a name-object pair into the JSON object

Declaration
%JSON_ObjectSetObject(
    INT in handle, 
    TEXT in field,
    INT in object
 )
Parameters
handleHandle to parent JSON object.
fieldField name
objectHandle to JSON object
Return value

None

Description

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

Exception is thrown if handle to parent JSON object or added JSON object 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)
Napíšte komentár