JsonObject::size()
Description
JsonObject::size()
returns the number of key-value pairs in the object pointed by the JsonObject
.
Internally, this function walks a linked-list to count the elements, so its time complexity is O(n).
If you want to loop over each key-value pair in the object, use iterators.
Signature
size_t size() const;
Return value
JsonObject::size()
return an unsigned integer that contains the number of key-value pairs in the object.
Example
JsonObject object = doc.to<JsonObject>();
object["hello"] = "world";
Serial.println(object.size()); // 1