deserialize a non json string gives inconsistent error result
Created by: AcuarioCat
Description Deserializing a non json string sometimes does not return a non zero error code.
Troubleshooter's report
- The issue happens at run time
- The issue concerns deserialization
- The program crashes
- Program crashes after calling
deserializeJson()
Environment
- Microcontroller: ESP32
- Core/Framework: ESP32 2.0.3
- IDE: Visual Micro
Reproduction code
DynamicJsonDocument root(800);
String s = "force an esp exception";
DeserializationError error = deserializeJson(root, s);
Serial.printf("Error:%d\n", error);
s = "definitely not a json";
error = deserializeJson(root, s);
Serial.printf("Error:%d\n", error);
s = "{\"value\":1,";
error = deserializeJson(root, s);
Serial.printf("Error:%d\n", error);
Remarks Result from above: Error:0 Error:3 Error:2
Error 0 should not be 0, should return 3