This page lists the known issues and limitations of ArduinoJson 7.

Most are compromises made to reduce the library’s size and are, therefore, unlikely to be fixed in the future.

Known issue 1: the parser isn’t strict

ArduinoJson’s parser is relatively lax and accepts some invalid inputs. For example, it doesn’t reject malformed UTF-16 surrogate pairs, like \ud83d\ud83d.

For that reason, you should not use ArduinoJson to validate JSON documents.

Known issue 2: the string-to-float conversion is not perfect

ArduinoJson 7’s string-to-float conversion is good but not perfect.

For example, if the input is "0.123", you’ll get 0.1230000000000001.

You can find details about this algorithm in my article Lightweight float to string conversion.

Known issue 3: the float-to-string conversion is not perfect either

ArduinoJson 7’s serializes 1.7976931348623147e308 into "1.797693135e308". The rounding is correct, but the value exceeds double’s range. This can be an issue because when we deserialize the document, we get inf.

Known issue 4: a JsonDocument is limited to 255, 64K, or 4M nodes depending on the architecture

ArduinoJson 7 uses integers instead of pointers to locate the nodes in the JsonDocument. The width of the integers depends on the CPU architecture.

CPU architecture Bytes for node id Max nodes
8-bit 1 255
32-bit 2 6,5635
64-bit 4 4,294,967,294

This should be enough for most applications, but if you need more, you can set ARDUINOJSON_SLOT_ID_SIZE to the desired number of bytes.

Known issue 5: the length of strings is limited to 255 or 64K characters, depending on the architecture

ArduinoJson 7 uses integers to store the length of strings. The width of the integers depends on the CPU architecture.

CPU architecture Length’s width String length MsgPack binary MsgPack extension
8-bit 1 byte 255 chars 253 bytes 252 bytes
32-bit 2 bytes 65,635 chars 65,632 bytes 65,631 bytes
64-bit 2 bytes 65,635 chars 65,632 bytes 65,631 bytes

This should be enough for most applications, but if you need more, you can set ARDUINOJSON_STRING_LENGTH_SIZE to the desired number of bytes.

Known issue 6: operator|’s return type

When you use the “or” operator to give a default value to a JsonVariant, the return type is deduced from the right-hand side. Most of the time, this causes no issue, but it can be very confusing in situations like this:

// Suppose doc contains {"id":2147483648}
uint32_t id = doc["id"] | 0;  // returns 0 :-(

The type of doc["id"] | 0 is deduced from the type of the default value, an int. Since the value in doc["id"] is out of int’s range, it returns the default value, 0.

You can work around this issue by changing the type of the right-hand side:

// Suppose doc contains {"id":2147483648}
uint32_t id = doc["id"] | 0U;  // returns 2147483648

Notice the U suffix that forces the type of the right-hand side to be unsigned int.

Global warming stripes by Professor Ed Hawkins (University of Reading)