The macro ARDUINOJSON_ENABLE_STD_STREAM enables the support of std::istream and std::ostream in the library.

Default value

ArduinoJson tries to guess whether std::istream/std::ostream are available or not, based on the presence of the ARDUINO macro.

The default value of ARDUINOJSON_ENABLE_STD_STREAM is:

  • 0 if ARDUINO is defined,
  • 1 otherwise.

In other words, ArduinoJson supports std::istream/std::ostream as soon as you work outside of Arduino.

How to force support for std::istream/std::ostream?

If you need to force the support of std::istream/std::ostream, add the following line at the top of your program:

#define ARDUINOJSON_ENABLE_STD_STREAM 1
#include <ArduinoJson.h>

How to disable support for std::istream/std::ostream?

If for some reason, you need to disable the support for std::istream/std::ostream, add the following line at the top of your program:

#define ARDUINOJSON_ENABLE_STD_STREAM 0
#include <ArduinoJson.h>

See also