Description

Returns the number of bytes used in the JsonDocument. Use this function at design time to measure the required capacity for the JsonDocument.

Signature

size_t memoryUsage() const;

Example

char json[] = "{\"hello\":\"world\"}";
StaticJsonDocument<200> doc;
deserializeJson(doc, json);

Serial.println(doc.memoryUage());
// prints 26 on AVR