Calling convention: CIP_JSON_GetValueByIndex(JSONObjectPointer: NativeInt, "TokenPath": String, ValueIndex: Integer, "ValueType": String): Variant
Description: Reads one indexed element from the JSON array at TokenPath and converts it to the requested MathParser type.
Parameters:
JSONObjectPointer = Valid pointer to a managed JSON value.
TokenPath = Path of the JSON array.
ValueIndex = Zero-based array index.
ValueType = STRING, INTEGER, NUMBER, DOUBLE, ARRAY or OBJECT.
Returns: Variant: converted array element, or a borrowed NativeInt pointer for ARRAY and OBJECT. Invalid paths, indexes or conversions may raise an exception.
Availability: Default.
Example:
try
WorkJSONString := "{
""name"":""John"",
""results"":[5234,2345,1221]
}";
JSONObj := CIP_JSON_CreateObject(WorkJSONString);
Result := CIP_JSON_GetValueByIndex(JSONObj, "results", 2, "INTEGER");
finally
CIP_JSON_FreeObject(JSONObj);
end;