- Notifications
You must be signed in to change notification settings - Fork1.1k
📟 JSON library for Arduino and embedded C++. Simple and efficient.
License
bblanchon/ArduinoJson
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
ArduinoJson is a C++ JSON library for Arduino and IoT (Internet Of Things).
- JSON deserialization
- Optionally decodes UTF-16 escape sequences to UTF-8
- Optionally supports comments in the input
- Optionally filters the input to keep only desired values
- Supports single quotes as a string delimiter
- Compatible withNDJSON andJSON Lines
- JSON serialization
- MessagePack serialization
- MessagePack deserialization
- Efficient
- Versatile
- Supportscustom allocators (to use external RAM chip, for example)
- Supports
String
,std::string
, andstd::string_view
- Supports
Stream
andstd::istream
/std::ostream
- SupportsFlash strings
- Supportscustom readers andcustom writers
- Supportscustom converters
- Portable
- Usable on any C++ project (not limited to Arduino)
- Compatible with C++11, C++14 and C++17
- Support for C++98/C++03 available onArduinoJson 6.20.x
- Zero warnings with
-Wall -Wextra -pedantic
and/W4
- Header-only library
- Works with virtually any board
- Tested on all major development environments
- Even works with online compilers like wandbox.org
- CMake friendly
- Well designed
- Elegant API
- Thread-safe
- Self-contained (no external dependency)
const
friendlyfor
friendly- TMP friendly
- Handlesinteger overflows
- Well tested
- Well documented
- Vibrant user community
- Most popular of all Arduino libraries onGitHub
- Used in hundreds of projects
- Responsive support
Here is a program that parses a JSON document with ArduinoJson.
constchar* json ="{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}";JsonDocument doc;deserializeJson(doc, json);constchar* sensor = doc["sensor"];long time = doc["time"];double latitude = doc["data"][0];double longitude = doc["data"][1];
See thetutorial on arduinojson.org
Here is a program that generates a JSON document with ArduinoJson:
JsonDocument doc;doc["sensor"] ="gps";doc["time"] =1351824120;doc["data"][0] =48.756080;doc["data"][1] =2.302038;serializeJson(doc, Serial);// This prints:// {"sensor":"gps","time":1351824120,"data":[48.756080,2.302038]}
See thetutorial on arduinojson.org
ArduinoJson is thankful to its sponsors. Please give them a visit; they deserve it!
If you run a commercial project that embeds ArduinoJson, think aboutsponsoring the library's development: it ensures the code that your products rely on stays actively maintained. It can also give your project some exposure to the makers' community.
If you are an individual user and want to support the development (or give a sign of appreciation), consider purchasing the bookMastering ArduinoJson ❤, or simplycast a star ⭐.
About
📟 JSON library for Arduino and embedded C++. Simple and efficient.