JsonDocument::clear()
Description
JsonDocument::clear()
empties JsonDocument
.
Unlike JsonArray::clear()
and JsonObject::clear()
, this function doesn’t need to perform any housekeeping so it’s a bit faster.
You don’t need to call JsonDocument::clear()
:
- after creating the
JsonDocument
- before destroying the
JsonDocument
- before calling
deserializeJson()
ordeserializeMsgPack()
- before calling
JsonDocument::to<T>()
These functions already clear the memory pool, so you don’t need to call JsonDocument::clear()
.
Every reference (JsonArray
, JsonObject
, or JsonVariant
) acquired before calling clear()
is invalidated.
Signature
void clear();