Description

ARDUINOJSON_NEGATIVE_EXPONENTIATION_THRESHOLD specifies the threshold beyond which ArduinoJson uses exponentiation to print small values.

The default is 1e-5, which means that any value smaller than 0.00001 will use the scientific notation.

Examples

Example with 1e-5

The following program uses a threshold of 1e-5:

#define ARDUINOJSON_NEGATIVE_EXPONENTIATION_THRESHOLD 1e-5
#include <ArduinoJson.h>

void example()
{
  JsonDocument doc;
  doc["speed"] = 0.000453;
  serializeJson(doc, Serial);
}

It produces the following output:

{"speed":0.000453}

Example with 1e-2

The following program uses a threshold of 1e-2:

#define ARDUINOJSON_NEGATIVE_EXPONENTIATION_THRESHOLD 1e-2
#include <ArduinoJson.h>

void example()
{
  JsonDocument doc;
  doc["speed"] = 0.000453;
  serializeJson(doc, Serial);
}

It produces the following output:

{"speed":4.53e-4}

See also