JsonGetArrayProperty Function

Action

Retrieves 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 array value, nothing happens.

Include file

Json.bdh

Syntax

JsonGetArrayProperty( in handle   : number,
                      in property : string,
                      out value   : number ): boolean;
Parameter Description
handle Valid handle to a JSON object
property Name of the property in the JSON object (case sensitive)
value Parameter that contains the value of the specified property. The value is a handle to a JSON array.

Return value

  • true if property successfully found
  • false otherwise

Example

transaction TMain
var
  jsonText      : string;
  jsonObject    : number;
  propertyValue : number;
begin
  WebParseDataBound(jsonText);
  WebPageUrl("http://mycompany.com/api/jsondata");
  jsonObject := JsonParse(jsonText);
  
  JsonGetArrayProperty(jsonObject, "JsonArrayPropertyName", propertyValue);
  
  Print("JSON array property: " + propertyValue);
  JsonFree(jsonObject);
end TMain;