`is<T>()` returns wrong value, only with bool
Created by: marvinroger
I am using an ESP8266 (NodeMCU 1.0) with the following sketch:
#include <ArduinoJson.h>
const char* json = "{\"ota\": {\"enabled\": true}}";
void setup() {
Serial.begin(115200);
Serial.println();
StaticJsonBuffer<JSON_OBJECT_SIZE(1) + JSON_OBJECT_SIZE(1)> jsonBuffer;
JsonObject& parsedJson = jsonBuffer.parseObject(json);
if (parsedJson["ota"]["enabled"].is<bool>()) {
Serial.println("ota.enabled is a bool");
} else {
Serial.println("ota.enabled is not a bool");
}
}
void loop() {
delay(1000);
}
This prints ota.enabled is not a bool
, but it obviously is.
Note I tested with const char*
, unsigned long
, JsonObject&
and it works well, the problem only appears with bool
.