ArduinoJson 6.0.0-beta * Added `DynamicJsonDocument` and `StaticJsonDocument` * Added `deserializeJson()` * Added `serializeJson()` and `serializeJsonPretty()` * Added `measureJson()` and `measureJsonPretty()` * Added `serializeMsgPack()`, `deserializeMsgPack()` and `measureMsgPack()` (issue #358) * Added example `MsgPackParser.ino` (issue #358) * Added support for non zero-terminated strings (issue #704) * Removed `JsonBuffer::parseArray()`, `parseObject()` and `parse()` * Removed `JsonBuffer::createArray()` and `createObject()` * Removed `printTo()` and `prettyPrintTo()` * Removed `measureLength()` and `measurePrettyLength()` * Removed all deprecated features
Summary
This release is the first of a new major revision of the library. It adds new features, like:
- MessagePack serialization and deserialization,
- Error code to tell why deserialization failed,
- Support for non zero terminated input.
Unfortunately, it requires changing the existing programs; please see the "breaking changes" section below.
More information on arduinojson.org
Changes since 5.13.2
- Added
DynamicJsonDocumentandStaticJsonDocument - Added
deserializeJson() - Added
serializeJson()andserializeJsonPretty() - Added
measureJson()andmeasureJsonPretty() - Added
serializeMsgPack(),deserializeMsgPack()andmeasureMsgPack()(issue #358) - Added example
MsgPackParser.ino(issue #358) - Added support for non zero-terminated strings (issue #704)
- Removed
JsonBuffer::parseArray(),parseObject()andparse() - Removed
JsonBuffer::createArray()andcreateObject() - Removed
printTo()andprettyPrintTo() - Removed
measureLength()andmeasurePrettyLength() - Removed all deprecated features
BREAKING CHANGES ⚠ ️
Deserialization
Old code:
DynamicJsonBuffer jb; JsonObject& obj = jb.parseObject(json); if (obj.success()) { }
New code:
DynamicJsonDocument doc; DeserializationError error = deserializeJson(doc, json); if (error) { } JsonObject& obj = doc.as<JsonObject>();
Serialization
Old code:
DynamicJsonBuffer jb; JsonObject& obj = jb.createObject(); obj["key"] = "value"; obj.printTo(Serial);
New code:
DynamicJsonDocument obj; JsonObject& obj = doc.to<JsonObject>(); obj["key"] = "value"; serializeJson(doc, Serial);
How to install
There are several ways to install ArduinoJson, from simpler to more complex:
- Use the Arduino Library Manager
- Download
ArduinoJson-v6.0.0-beta.hput it in your project folder - Download
ArduinoJson-v6.0.0-beta.zipand extract it in youlibrariesfolder
Note: ArduinoJson-v6.0.0-beta.h are ArduinoJson-v6.0.0-beta.hpp are almost identical; the difference is that the .hpp keeps everything in the ArduinoJson namespace.