Known issues
This page lists the known issues and limitations of ArduinoJson 7.
They are all compromises made to reduce the size of the library 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.