%JSON_ObjectGetValue function


Function

Gets a value in a field from the JSON object.

Declaration


UNIVAL %JSON_ObjectGetValue(
    INT in handle, 
    TEXT in field
 )


Parameters


handleHandle to parent JSON object.
fieldField name


Return value

Value of type BOOL, INT, REAL or TEXT, or invalid value.

Description

Function gets a value in a field from the JSON object.

Exception is thrown if item at index is not value, handle to JSON object is invalid or field does not exists.

Example


 INT _obj
 _obj := %JSON_ObjectFromString('{"Name":"John"}')
 
 TEXT _txt
 _txt := %JSON_ObjectGetValue(_obj, "Name")

 %JSON_FreeObjectHandle(_obj)