JsonGetArrayLength Function

Action

Retrieves the number of elements in a JSON array. Number of elements := last index + 1

Include file

Json.bdh

Syntax

JsonGetArrayLength( in handle : number ): number;
Parameter Description
handle Valid handle to a JSON array

Return value

The number of elements in the JSON array.

Example

transaction TMain
var
  jsonArray   : number;
  arrayLength : number;
begin
  jsonArray := JsonParse("[0,1,2,3,4]");
  arrayLength := JsonGetArrayLength(jsonArray);
  Print("Length: " + string(arrayLength));
  JsonFree(jsonArray);
end TMain;

Output


Length: 5