Description

JsonDocument::overflowed() tells if the JsonDocument failed to store a value.

Storing a value can fail for two reasons:

  1. The heap is exhausted: there is not enough free memory to expand the JsonDocument.
  2. The maximum number of slots was reached (see table below).
  3. One or more string exceeds the maxium length (see table below).
CPU architecture Max slots Max string length
8-bit 255 255
32-bit 65,635 65,635
64-bit 4,294,967,294 65,635

You can increase the number of slots by changing ARDUINOJSON_SLOT_ID_SIZE.
You can increase the maximum string length by changing ARDUINOJSON_STRING_LENGTH_SIZE.
ArduinoJson Assitant is aware of these limitations and will tell you if you need to change these settings.

Calling JsonDocument::clear() clears the “overflowed” flag.

Signature

bool overflowed() const;

Return value

JsonDocument::overflowed() returns a bool that tells if the memory pool overflowed

  • false when all values were stored successfully.
  • true when at least one value could not be stored.

See also