
If the input is a char*, ensure the input buffer stays in memory until the JsonDocument is destructed. Prefer the first mode when the input comes from a Stream prefer the second when the input is in a buffer. Because the JsonDocument stores pointers to the input buffer, you must ensure that this buffer remains in memory.

In this mode, the JsonDocument can be smaller, but ArduinoJson needs to modify the input buffer to insert null-terminators and replace escaped characters. For a writeable input, it stores pointers to the strings in the input buffer.This duplication consumes additional space in the JsonDocument. For a read-only input, it duplicates the strings in the input document.This function behaves differently depending on the type of input:

The function deserializeJson() parses a JSON input and puts the result in a JsonDocument.īefore reading the input, this function resets the document, so you don’t need to call JsonDocument::clear().
