ArduinoJson 5’s Release Notes
This page contains the release notes (changelog) for all versions of ArduinoJson 5.
Click on a version to see the details.
See the dedicated article: ArduinoJson finally works in the Particle IDE.
Changes
- Removed spurious files in the Particle library
Download links
Online examples
See the dedicated article: ArduinoJson 5.13.2 is out!.
Changes
- 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
…
Download links
Online examples
See the dedicated article: ArduinoJson 5.13.0 is out!.
Changes
- 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.
Download links
Online examples
See the dedicated article: ArduinoJson 5.12.0 is out!.
Changes
- 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";
Download links
Changes
- 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)
Download links
Changes
- Removed configurable number of decimal places (issues #288, #427 and #506)
- Changed exponentiation 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
Download links
Changes
- Added
JsonArray::remove(iterator)
(issue #479) - Added
JsonObject::remove(iterator)
- Renamed
JsonArray::removeAt(size_t)
intoremove(size_t)
- Renamed folder
include/
tosrc/
- Fixed warnings
floating constant exceeds range of float
andfloating constant truncated to zero
(issue #483) - Removed
Print
class and convertedprintTo()
to a template method (issue #276) - Removed example
IndentedPrintExample.ino
- Now compatible with Particle 0.6.1, thanks to Jacob Nite (issue #294 and PR #461 by @foodbag)
Download links
Changes
- Fixed parsing of comments (issue #421)
- Fixed ignored
Stream
timeout (issue #422) - Made sure we don’t read more that necessary (issue #422)
- Fixed error when the key of a
JsonObject
is achar[]
(issue #423) - Reduced code size when using
const
references - Fixed error with string of type
unsigned char*
(issue #428) - Added
deprecated
attribute onasArray()
,asObject()
andasString()
(issue #420)
Changes
- Added operator
==
to compareJsonVariant
and strings (issue #402) - Added support for
Stream
(issue #300) - Reduced memory consumption by not duplicating spaces and comments
BREAKING CHANGES
JsonBuffer::parseObject()
andJsonBuffer::parseArray()
have been pulled down to the derived classesDynamicJsonBuffer
andStaticJsonBufferBase
.This means that if you have code like:
void myFunction(JsonBuffer& jsonBuffer);
you need to replace it with one of the following:
void myFunction(DynamicJsonBuffer& jsonBuffer); void myFunction(StaticJsonBufferBase& jsonBuffer); template<typename TJsonBuffer> void myFunction(TJsonBuffer& jsonBuffer);
Changes
- Templatized all functions using
String
orstd::string
- Removed
ArduinoJson::String
- Removed
JsonVariant::defaultValue<T>()
- Removed non-template
JsonObject::get()
andJsonArray.get()
- Fixed support for
StringSumHelper
(issue #184) - Replaced
ARDUINOJSON_USE_ARDUINO_STRING
byARDUINOJSON_ENABLE_STD_STRING
andARDUINOJSON_ENABLE_ARDUINO_STRING
(issue #378) - Added example
StringExample.ino
to show whereString
can be used - Increased default nesting limit to 50 when compiled for a computer (issue #349)
BREAKING CHANGES
The non-template functions
JsonObject::get()
andJsonArray.get()
have been removed. This means that you need to explicitely tell the type you expect in return.Old code:
#define ARDUINOJSON_USE_ARDUINO_STRING 0 JsonVariant value1 = myObject.get("myKey"); JsonVariant value2 = myArray.get(0);
New code:
#define ARDUINOJSON_ENABLE_ARDUINO_STRING 0 #define ARDUINOJSON_ENABLE_STD_STRING 1 JsonVariant value1 = myObject.get<JsonVariant>("myKey"); JsonVariant value2 = myArray.get<JsonVariant>(0);
Changes
- Made the library compatible with PlatformIO (issue #181)
- Fixed
JsonVariant::is<bool>()
that was incorrectly returning false (issue #214)
Changes
- Made library easier to use from a CMake project: simply
add_subdirectory(ArduinoJson/src)
- Changed
String
to be atypedef
ofstd::string
(issues #142 and #161)
BREAKING CHANGES
JsonVariant(true).as<String>()
now returns"true"
instead of"1"
JsonVariant(false).as<String>()
now returns"false"
instead of"0"
Changes
- Fixed segmentation fault in
parseObject(String)
andparseArray(String)
, when theStaticJsonBuffer
is too small to hold a copy of the string - Fixed Clang warning “register specifier is deprecated” (issue #102)
- Fixed GCC warning “declaration shadows a member” (issue #103)
- Fixed memory alignment, which made ESP8266 crash (issue #104)
- Fixed compilation on Visual Studio 2010 and 2012 (issue #107)
Changes
- Added support of
String
class (issues #55, #56, #70, #77) - Added
JsonBuffer::strdup()
to make a copy of a string (issues #10, #57) - Implicitly call
strdup()
forString
but not forchar*
(issues #84, #87) - Added support of non standard JSON input (issue #44)
- Added support of comments in JSON input (issue #88)
- Added implicit cast between numerical types (issues #64, #69, #93)
- Added ability to read number values as string (issue #90)
- Redesigned
JsonVariant
to leverage converting constructors instead of assignment operators (issue #66) - Switched to new the library layout (requires Arduino 1.0.6 or above)
BREAKING CHANGES
JsonObject::add()
was renamed toset()
JsonArray::at()
andJsonObject::at()
were renamed toget()
- Number of digits of floating point value are now set with
double_with_n_digits()
Personal note about the String
class:
Support of the String
class has been added to the library because many people use it in their programs.
However, you should not see this as an invitation to use the String
class.
The String
class is bad because it uses dynamic memory allocation.
Compared to static allocation, it compiles to a bigger, slower program, and is less predictable.
You certainly don’t want that in an embedded environment!