These functions retrieve the value of a specified property from a JSON object. If the property does not exist in the JSON object or the property does not contain a JSON object value or a JSON array value, nothing happens.
JSON objects and JSON arrays that are received by these functions can be removed from memory with JsonFree. However, objects and arrays are automatically deleted when you call JsonFree on the parent JSON object.
dcltrans transaction TMain var jsonParentString : string; jsonParent : number; jsonArray : number; jsonObject : number; begin jsonParentString := "{" "\"NestedObjectProperty\": {" "\"Name\": \"Nested Object\"" "}," "\NestedArrayProperty\": [10,20,true,40]" "}"; jsonParent := JsonParse(jsonParentString); JsonGetArrayProperty(jsonParent, "NestedArrayProperty", jsonArray); JsonGetObjectProperty(jsonParent, "NestedObjectProperty", jsonObject); ... JsonFree(jsonParent); end TMain;
These functions retrieve the value of a specified element from a JSON array. Their behavior is similar to the behavior of the functions JsonGetObjectProperty and JsonGetArrayProperty. The only difference is that they return specified elements from a JSON array instead of properties from a JSON object.
dcltrans transaction TMain var jsonParentString : string; jsonParent : number; jsonArray : number; jsonObject : number; begin jsonParentString := "[" "{" "\"Name\": \"Nested Object\"" "}," "[10,20,true,40]" "]"; jsonParent := JsonParse(jsonParentString); JsonArrayGetArrayElement(jsonParent, "NestedArrayProperty", jsonArray); JsonArrayGetObjectElement(jsonParent, "NestedObjectProperty", jsonObject); ... JsonFree(jsonParent); end TMain;