You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The valid JSON {"foo": "bar \"foo\", baz"} gets turned into the broken JSON {"foo": "bar \\"foo"} when using repair_json.
I think this is related to the escaped quotes and comma.
so this is a tough one because if you pass that string to python without using r"" the string passed is: {"foo": "bar "foo", baz"} and the result is correct because it's impossible to know in advance if that comma closes the key/value pair or is part of the string.
if you call repair_json(r'{"foo": "bar \"foo\", baz"}') the result is correctly {"foo": "bar \"foo\", baz"}
I thought my problem was related to escaped quotes but apparently it is not and now i can't seem to figure it out:
I would expect {"foo": "bar \"e\", .", "g": ["h:"]]} to get repaired to {"foo": "bar \"e\", .", "g": ["h:"]} but repair_json(r'{"foo": "bar \"e\", .", "g": ["h:"]]}') returns {"foo": "bar \\\"e\\", ",": ": [\"h:"}.
Describe the bug
The valid JSON
{"foo": "bar \"foo\", baz"}
gets turned into the broken JSON{"foo": "bar \\"foo"}
when usingrepair_json
.I think this is related to the escaped quotes and comma.
To Reproduce
Steps to reproduce the behavior:
repair_json('{"foo": "bar \"foo\", baz"}')
{"foo": "bar \\"foo"}
Expected behavior
Correct output
{"foo": "bar \"foo\", baz"}
The text was updated successfully, but these errors were encountered: