Description

If the JsonVariantConst points to an object, JsonVariantConst::size() returns the number of key-value pairs in the object (same as JsonObjectConst::size())

If the JsonVariantConst points to an array, JsonVariantConst::size() returns the number of elements in the array (same as JsonArrayConst::size())

In all other cases, JsonVariantConst::size() returns 0

Internally, this function walks a linked-list to count the elements, so its time complexity is O(n).

Don’t confuse JsonVariantConst::size() with JsonVariantConst::memoryUsage().

Signature

size_t size() const;

See also