Description

JsonArray::size() gets the number of element in the array pointed by the JsonArray.

If the JsonArray is null, this function returns 0.

Signature

size_t size() const;

Return value

JsonArray::size() returns an unsigned integer containing the number of elements in the array.

Example

JsonArray array = doc.to<JsonArray>();
array.add("hello");
array.add("world");
Serial.println(array.size()); // 2

See also