Something went wrong while setting issue due date.
Using auto type to access array nested in object crashes device
Closed
Using auto type to access array nested in object crashes device
Created by: prototypicalpro
Description Running the following code snippet works great:
StaticJsonDocument<500> doc;
constexpr char str[] = "{\"contents\":[{\"module\":\"Packet\"},{\"module\":\"Analog\"}]}";
deserializeJson(doc, str);
JsonObject sensor = thing["contents"][1];
Serial.println(sensor.isNull()); // <- prints "0"
however, changing the type to auto
causes my device to hang:
StaticJsonDocument<500> doc;
constexpr char str[] = "{\"contents\":[{\"module\":\"Packet\"},{\"module\":\"Analog\"}]}";
deserializeJson(doc, str);
auto sensor = thing["contents"][1];
Serial.println(sensor.isNull()); // <- Never printed, and must be reset to continue
I suspect this issue is due to ElementProxy
type not resolving properly, but am unsure why this would be causing the device to crash.
Platform I am using ArduinoJson 6.12.0, Arduino IDE 1.8.10, and running this sketch on the Adafruit Feather M0 (SAMD21) with Adafruit SAMD Core 1.5.2 . I've attached the relevant sketch, as well as the build log.