Releases: bblanchon/ArduinoJson
ArduinoJson 6.0.0-beta
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
DynamicJsonDocument
andStaticJsonDocument
- 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.h
put it in your project folder - Download
ArduinoJson-v6.0.0-beta.zip
and extract it in youlibraries
folder
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.
Try online
ArduinoJson 5.13.2
Changes since 5.13.1
- Fixed
JsonBuffer::parse()
not respecting nesting limit correctly (issue #693) - Fixed inconsistencies in nesting level counting (PR #695 from Zhenyu Wu)
- Fixed null values that could be pass to
strcmp()
(PR #745 from Mike Karlesky) - Added macros
ARDUINOJSON_VERSION
,ARDUINOJSON_VERSION_MAJOR
...
How to install
There are several ways to install ArduinoJson, from simpler to more complex:
- Use the Arduino Library Manager
- Download
ArduinoJson-v5.13.2.h
put it in your project folder - Download
ArduinoJson-v5.13.2.zip
and extract it in youlibraries
folder
Note: ArduinoJson-v5.13.2.h
are ArduinoJson-v5.13.2.hpp
are almost identical; the difference is that the .hpp
keeps everything in the ArduinoJson
namespace.
ℹ️ The complete documentation is available on arduinojson.org
Try online
ArduinoJson 5.13.1
Changes since 5.13.0
- Fixed
JsonVariant::operator|(int)
that returned the default value if the variant contained a double (issue #675) - Allowed non-quoted key to contain underscores (issue #665)
How to install
There are several ways to install ArduinoJson, from simpler to more complex:
- Use the Arduino Library Manager
- Download
ArduinoJson-v5.13.1.h
put it in your project folder - Download
ArduinoJson-v5.13.1.zip
and extract it in youlibraries
folder
Note: ArduinoJson-v5.13.1.h
are ArduinoJson-v5.13.1.hpp
are almost identical; the difference is that the .hpp
keeps everything in the ArduinoJson
namespace.
ℹ️ The complete documentation is available on arduinojson.org
Try online
ArduinoJson 5.13.0
Changes since 5.12.0
- Changed the rules of string duplication (issue #658)
RawJson()
accepts any kind of string and obeys to the same rules for duplication- Changed the return type of
strdup()
toconst char*
to prevent double duplication - Marked
strdup()
as deprecated
New rules for string duplication
type duplication const char* no char* noyesString yes std::string yes const __FlashStringHelper* yes These new rules make
JsonBuffer::strdup()
useless.
How to install
There are several ways to install ArduinoJson, from simpler to more complex:
- Use the Arduino Library Manager
- Download
ArduinoJson-v5.13.0.h
put it in your project folder - Download
ArduinoJson-v5.13.0.zip
and extract it in youlibraries
folder
Note: ArduinoJson-v5.13.0.h
are ArduinoJson-v5.13.0.hpp
are almost identical; the difference is that the .hpp
keeps everything in the ArduinoJson
namespace.
ℹ️ The complete documentation is available on arduinojson.org
Try online
ArduinoJson 5.12.0
Changes since 5.11.2
- Added
JsonVariant::operator|
to return a default value (see below) - Added a clear error message when compiled as C instead of C++ (issue #629)
- Added detection of MPLAB XC compiler (issue #629)
- Added detection of Keil ARM Compiler (issue #629)
- Added an example that shows how to save and load a configuration file
- Reworked all other examples
How to use the new feature?
If you have a block like this:
const char* ssid = root["ssid"]; if (!ssid) ssid = "default ssid";You can simplify like that:
const char* ssid = root["ssid"] | "default ssid";
How to install
There are several ways to install ArduinoJson, from simpler to more complex:
- Use the Arduino Library Manager
- Download
ArduinoJson-v5.12.0.h
put it in your project folder - Download
ArduinoJson-v5.12.0.zip
and extract it in youlibraries
folder
Note: ArduinoJson-v5.12.0.h
are ArduinoJson-v5.12.0.hpp
are almost identical; the difference is that the .hpp
keeps everything in the ArduinoJson
namespace.
ℹ️ The complete documentation is available on arduinojson.org
Try online
ArduinoJson 5.11.2
Changes since 5.11.1
- Fixed
DynamicJsonBuffer::clear()
not resetting allocation size (issue #561) - Fixed incorrect rounding for float values (issue #588)
How to install
There are several ways to install ArduinoJson, from simpler to more complex:
- Use the Arduino Library Manager
- Download
ArduinoJson-v5.11.2.h
below and put it in your project folder - Download
ArduinoJson-v5.11.2.zip
and extract it in youlibraries
folder
Note: ArduinoJson-v5.11.2.h
are ArduinoJson-v5.11.2.hpp
are almost identical; the difference is that the .hpp
keeps everything in the ArduinoJson
namespace.
ℹ️ The complete documentation is available on arduinojson.org
Try online
ArduinoJson 5.11.1
Changes since 5.11.0
- Removed dependency on
PGM_P
as Particle 0.6.2 doesn't define it (issue #546) - Fixed warning "dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]"
- Fixed warning "floating constant exceeds range of 'float' [-Woverflow]" (issue #544)
- Fixed warning "this statement may fall through" [-Wimplicit-fallthrough=] (issue #539)
- Removed
ARDUINOJSON_DOUBLE_IS_64BITS
as it became useless. - Fixed too many decimals places in float serialization (issue #543)
How to install
There are several ways to install ArduinoJson, from simpler to more complex:
- Use the Arduino Library Manager
- Download
ArduinoJson-v5.11.1.h
below and put it in your project folder - Download
ArduinoJson-v5.11.1.zip
and extract it in youlibraries
folder
Note: ArduinoJson-v5.11.1.h
are ArduinoJson-v5.11.1.hpp
are almost identical; the difference is that the .hpp
keeps everything in the ArduinoJson
namespace.
Try online
ArduinoJson 5.11.0
Changes since 5.10.1
- Made
JsonBuffer
non-copyable (PR #524 by @luisrayas3) - Added
StaticJsonBuffer::clear()
- Added
DynamicJsonBuffer::clear()
How to install
There are several ways to install ArduinoJson, from simpler to more complex:
- Use the Arduino Library Manager
- Download
ArduinoJson-v5.11.0.h
below and put it in your project folder - Download
ArduinoJson-v5.11.0.zip
and extract it in youlibraries
folder
Note: ArduinoJson-v5.11.0.h
are ArduinoJson-v5.11.0.hpp
are almost identical; the difference is that the .hpp
keeps everything in the ArduinoJson
namespace.
Try online
ArduinoJson 5.10.1
Changes since 5.10.0
- Fixed IntelliSense errors in Visual Micro (issue #483)
- Fixed compilation in IAR Embedded Workbench (issue #515)
- Fixed reading "true" as a float (issue #516)
- Added
ARDUINOJSON_DOUBLE_IS_64BITS
- Added
ARDUINOJSON_EMBEDDED_MODE
How to install
There are several ways to install ArduinoJson, from simpler to more complex:
- Use the Arduino Library Manager
- Download
ArduinoJson-v5.10.1.h
below and put it in your project folder - Download
ArduinoJson-v5.10.1.zip
and extract it in youlibraries
folder
Note: ArduinoJson-v5.10.1.h
are ArduinoJson-v5.10.1.hpp
are almost identical; the difference is that the .hpp
keeps everything in the ArduinoJson
namespace.
Try online
v5.10.0: ArduinoJson 5.10.0
Changes since 5.9.0
- Removed configurable number of decimal places (issues #288, #427 and #506)
- Changed exponentation thresholds to
1e7
and1e-5
(issues #288, #427 and #506) JsonVariant::is<double>()
now returnstrue
for integers- Fixed error
IsBaseOf is not a member of ArduinoJson::TypeTraits
(issue #495) - Fixed error
forming reference to reference
(issue #495)
BREAKING CHANGES ⚠️
Old syntax | New syntax |
---|---|
double_with_n_digits(3.14, 2) |
3.14 |
float_with_n_digits(3.14, 2) |
3.14f |
obj.set("key", 3.14, 2) |
obj["key"] = 3.14 |
arr.add(3.14, 2) |
arr.add(3.14) |
Input | Old output | New output |
---|---|---|
3.14159 |
3.14 |
3.14159 |
42.0 |
42.00 |
42 |
0.0 |
0.00 |
0 |
Expression | Old result | New result |
---|---|---|
JsonVariant(42).is<int>() |
true |
true |
JsonVariant(42).is<float>() |
false |
true |
JsonVariant(42).is<double>() |
false |
true |
How to install
There are several ways to install ArduinoJson, from simpler to more complex:
- Use the Arduino Library Manager
- Download
ArduinoJson-v5.10.0.h
below and put it in your project folder - Download
ArduinoJson-v5.10.0.zip
and extract it in youlibraries
folder
Note: ArduinoJson-v5.10.0.h
are ArduinoJson-v5.10.0.hpp
are almost identical; the difference is that the .hpp
keeps everything in the ArduinoJson
namespace.