JsonArray::size()
Description
JsonArray::size() gets the number of elements in the array pointed by the JsonArray.
If the JsonArray is null, this function returns 0.
Internally, this function walks a linked-list to count the elements, so its time complexity is O(n).
Don’t use this function to create a for loop; instead, use iterators.
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