%JSON_ObjectSetValue function


Function

Add name-value pair into JSON object

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

None

Description

Function adds name-value pair into JSON object. Supported types are BOOL, INT, REAL, TEXT and invalid value. If you want to insert TIME, first you have to convert it to TEXT.

Exception is thrown if handle to parent JSON object is invalid, new value have unsupported type or field does not exists.

Example
 INT _obj
 _obj := %JSON_CreateObject()
 
 %JSON_ObjectSetValue(_obj, "Company", "IPESOFT")
 %JSON_ObjectSetValue(_obj, "Value", 365)
 %JSON_ObjectSetValue(_obj, "Real", 1.234)
 %JSON_ObjectSetValue(_obj, "State", @TRUE)
 %JSON_ObjectSetValue(_obj, "Variable", U.uservariable)

 %JSON_FreeObjectHandle(_obj)

0 komentárov

Nie ste prihlásený. Akékoľvek zmeny, ktoré vykonáte, sa označia ako anonymné. Ak už máte svoj účet, pravdepodobne sa budete chcieť prihlásiť .