Subject to changeVersion 6 is currently in beta, so the API
Unless you need the new features of version 6 (e.g. MessagePack), please use version 5.
Version 6 should stay in beta stage until the end of 2018.
ArduinoJson defines several macros to allow a program to detect the version of the library.
There are four macros:
ARDUINOJSON_VERSIONis a string that is typically used to display the version to the user
ARDUINOJSON_VERSION_MAJORcontains the major version number
ARDUINOJSON_VERSION_MINORcontains the minor version number
ARDUINOJSON_VERSION_REVISIONcontains the revision number
For example, ArduinoJson 6.0.1-beta defines the following:
#define ARDUINOJSON_VERSION "6.0.1-beta" #define ARDUINOJSON_VERSION_MAJOR 6 #define ARDUINOJSON_VERSION_MINOR 0 #define ARDUINOJSON_VERSION_REVISION 1
How to use?
How to detect that ArduinoJson is available?
#ifndef ARDUINOJSON_VERSION #error ArduinoJson not found, please include ArduinoJson.h in your .ino file #endif
How to verify that the right version is installed?
#if ARDUINOJSON_VERSION_MAJOR!=6 || ARDUINOJSON_VERSION_MINOR<1 #error ArduinoJson 6.1+ is required #endif
How to display ArduinoJson version?
Serial.print("Using ArduinoJson version "); Serial.println(ARDUINOJSON_VERSION);
These macros are available since ArduinoJson 5.13.2