-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESP32 S3 crash on deserializeJson in version 7.2.0 #2135
Comments
Hi @shm4r7, Thank you very much for reporting this bug ❤️ I didn't anticipate this use case, and I would need to think this through. Allowing the caller to pass a deserializeJson(doc.to<JsonObject>(), "[1,2,3]"); In this case, the program expects an object but receives an array; it's not the situation you are in, but the current API allows it to happen. I see two ways to handle this situation:
I'm currently leaning toward option 1 as it's simpler to implement. Meanwhile, pass a String prepareESPInfo()
{
JsonObject obj = shmartMcuInfoDoc.to<JsonObject>();
auto features = getSupportedShmartFeatures();
- auto featuresObject = obj["features"].to<JsonObject>();
- deserializeJson(featuresObject, features);
+ deserializeJson(obj["features"], features);
serializeJson(shmartMcuInfoDoc, shmartMcuInfo);
return shmartMcuInfo;
} Best regards, |
Hi @bblanchon, thank you for detailed explanation, It seems that I unnecesarily complicated thing calling Regards |
The fix is available in ArduinoJson 7.2.1 |
Describe the bug
My application crashes when calling
deserializeJson
- it started to happen after upgrade to version 7.2.0, in version 7.1.0 this code worked as I expected.Environment
Here is the environment that I used:
Reproduction
Here is a small snippet that reproduces the issue.
Compiler output
No errors during compilation
Program output
When it crash this is what is logged
And here is a top stack of decoded esp32 exception:
Expected output:
deserializeJson should work as it did in version 7.1.0 without throwing exception
The text was updated successfully, but these errors were encountered: