Function EN Version 12.11

@JsonSize

Json

Syntax

@JsonSize(HJSON);

Description

This @Function returns the number of elements in a JSON array or the number of keys in a JSON object.

For a JSON array, the return value is the number of array elements contained in the array.
For a JSON object, the return value is the number of contained key/value pairs.

HJSON must contain a valid VSPECHJSON (HJS) handle referencing a JSON object or JSON array.
As return value, the @Function returns @ERROR on failure; otherwise, it returns the number of elements as FLOAT.


Beispiel: @JsonSize(HJSON); (JSON-Object)

HJSON:=@JsonParse("{\"Name\":\"Max Mustermann\",\"Age\":42,\"Active\":true}");
SIZE:=@JsonSize(HJSON);
@JsonRelease(HJSON);

SIZE contains:
3

Beispiel: @JsonSize(HJSON); (JSON-Array)

HJSON:=@JsonParse("[\"A\",\"B\",\"C\",\"D\"]");
SIZE:=@JsonSize(HJSON);
@JsonRelease(HJSON);

SIZE contains:
4

Note : This text was machine-translated and may contain inaccuracies.