Calling convention: CIP_JSON_GetValueIfExists(JSONObjectPointer: NativeInt, "TokenPath": String, "ValueType": String, DefaultValue: Variant): Variant
Description: Tries to read and convert a JSON value, returning DefaultValue when lookup or conversion is unsuccessful.
Parameters:
JSONObjectPointer = Pointer to a managed JSON value.
TokenPath = Path of the requested value.
ValueType = STRING, INTEGER, NUMBER, DOUBLE, ARRAY or OBJECT.
DefaultValue = Value returned when the requested value is unavailable.
Returns: Variant: converted value when found; otherwise DefaultValue. NULL or 0 pointers return DefaultValue; an invalid nonzero pointer raises an exception.
Availability: Default.
Example:
try
JSONObj := CIP_JSON_CreateObject("{""name"":""John""}");
Result := CIP_JSON_GetValueIfExists(JSONObj, "name", "STRING", "DefaultValue");
finally
CIP_JSON_FreeObject(JSONObj);
end;