JsonObject::clear()
Description
JsonObject::clear()
removes all members from the object pointed by the JsonObject
.
If the JsonObject
is null/unbound, this function does nothing.
Causes memory leaks ⚠️
Because
JsonDocument
contains a monotonic allocator, this function cannot release the memory associated with the removed value.
Consequently, you cannot call this function in a loop; otherwise, theJsonDocument
will overflow.
Prefer JsonDocument::clear()
which doesn’t leak memory.
Signatures
void clear() const;