Closed bblanchon closed 4 years ago
Hi @bblanchon,
The goal of this library is to be simple to use, and avoid C/C++ concepts that Arduino users are not familiar with.
Hi @sandeepmistry,
Thank you for your answer but it doesn't provide any comparison with ArduinoJson, nor any guidance to choose one or the other.
I made my own comparison and benchmark; you can read the article on arduinojson.org Here is a summary of the article:
ArduinoJson | Arduino_JSON | |
---|---|---|
JSON serialization | ✔️ | ✔️ |
JSON deserialization | ✔️ | ✔️ |
Decode UTF-16 literals | ✔️ | ✔️ |
Comments in JSON input | ✔️ | |
Single quotes in JSON input | ✔️ | |
Prettified output | ✔️ | |
Deserialization error information | ✔️ |
ArduinoJson | Arduino_JSON | |
---|---|---|
Arduino String |
✔️ | ✔️ |
Flash strings | ✔️ | ✔️ |
Arduino streams | ✔️ | |
STL string | ✔️ | |
STL streams | ✔️ | |
long long |
✔️ |
ArduinoJson | Arduino_JSON | |
---|---|---|
Access values with [] |
✔️ | ✔️ |
Implicit casts | ✔️ | ✔️ |
Namespace | ✔️ | |
const friendly |
✔️ | |
for friendly |
✔️ | |
template friendly |
✔️ | |
Deserialization error information | ✔️ | |
Usable outside of Arduino | ✔️ |
ArduinoJson | Arduino_JSON | |
---|---|---|
Thread-safe | ✔️ | ✔️ |
MessagePack serialization | ✔️ | |
MessagePack deserialization | ✔️ | |
Stack-only allocation | ✔️ | |
Fixed heap allocation | ✔️ | |
Zero-copy | ✔️ |
ArduinoJson | Arduino_JSON | |
---|---|---|
License | MIT | LGPL |
Test coverage | 98% | 0% |
Popularity | 4055 | 21 |
Documentation | ✔️ |
Serial
ArduinoJson | Arduino_JSON | |
---|---|---|
Program size | 3.6 KB ✔️ | 7.9 KB |
Running time | 2.2 ms ✔️ | 2.3 ms |
Heap allocations | 0 ✔️ | 20 |
RAM usage | 426 B ✔️ | 454 B |
Fragmentation | 0 % ✔️ | 1.5 % |
String
ArduinoJson | Arduino_JSON | |
---|---|---|
Program size | 5.2 KB ✔️ | 8.0 KB |
Running time | 2.1 ms | 1.9 ms ✔️ |
Heap allocations | 2 ✔️ | 21 |
RAM usage | 499 B ✔️ | 534 B |
Fragmentation | 0 % ✔️ | 6.21 % |
char[]
ArduinoJson | Arduino_JSON | |
---|---|---|
Program size | 3.8 KB ✔️ | 8.2 KB |
Running time | 1.7 ms ✔️ | 1.9 ms |
Heap allocations | 0 ✔️ | 21 |
RAM usage | 492 B ✔️ | 522 B |
Fragmentation | 0 % | 0 % |
const char*
ArduinoJson | Arduino_JSON | |
---|---|---|
Program size | 4.0 KB ✔️ | 11 KB |
Running time | 0.8 ms ✔️ | 0.9 ms |
Heap allocations | 0 ✔️ | 10 |
RAM usage | 449 B ✔️ | 540 B |
Fragmentation | 0 % | 0% |
char[]
ArduinoJson | Arduino_JSON | |
---|---|---|
Program size | 4.1 KB ✔️ | 11 KB |
Running time | 0.8 ms ✔️ | 0.9 ms |
Heap allocations | 0 ✔️ | 10 |
RAM usage | 488 B ✔️ | 540 B |
Fragmentation | 0 % | 0% |
Using a char[]
enables the zero-copy mode of ArduinoJson, saving a large amount of memory.
Serial
ArduinoJson | Arduino_JSON | |
---|---|---|
Program size | 4.2 KB ✔️ | 11.3 KB |
Running time | 2.9 ms ✔️ | 1004 ms |
Heap allocations | 0 ✔️ | 73 |
RAM usage | 387 B ✔️ | 468 B |
Fragmentation | 0 % ✔️ | 3.82 % |
Best Regards, Benoit
Hi!
I'm the developer of ArduinoJson. I'm curious to know how this library differs from it. Why should someone choose this one over ArduinoJson?
Best Regards, Benoit