Closed zvirja closed 1 month ago
Thank you very much for reporting this issue. The fix will be included in ArduinoJson 7.2.0 very soon.
@bblanchon Wow, thanks for a really fast fix! 😯☺
Is it worth to have logic that escape sequences are different depending on whether we are in single or double quotes surrounding context? So that in the { "summary": "a\\'b" }
context sequence is kept as-is and vice versa? I.e. value is a\'b
after deserializing instead of a'b
.
Maybe that's what is already happening or maybe it makes not much sense - it was just a thought.
This one should work as before since it's the backslash that is escaped, not the quote.
{"summary": "a\\'b"}
However, the following one used to return InvalidInput
but will now return Ok
:
{"summary": "a\'b"}
I think it's correct, even if it's not standard. ArduinoJson never intended to be a strict parser.
The fix is available in ArduinoJson 7.2.0.
@bblanchon Just verified it with Home Assistant - works like a charm! Thanks for your fast reply and being so nice ❤️
You're welcome, @zvirja. Thank you for using ArduinoJson! Don't forget to cast a star to support the project :wink:
Describe the bug
Library fails to parse JSON when using single quotes for JSON structure and escaping it inside the value. I know that it's a bit weird to use single quote for JSON elements, but that's what HomeAssistant & ESPHome are doing 😢
Troubleshooter report
Irrelevant
Environment
Here is the environment that I used:
Reproduction
Here is a small snippet that reproduces the issue.
Program output
Expected output:
Actual output:
Note:
It works when using double-quotes and escape those: