mangiucugna/json_repair

Wrong result when parsing json with trailing texts.

liangjs opened this issue · 1 comments

Describe the bug
Wrong result when parsing json with trailing texts.

To Reproduce
The following code should return {'a': '', 'b': [{'c': 1}]}

json_repair.loads("""{"a": "", "b": [ { "c": 1} ]}```""")
# This is parsed to {'a': ', "b'}

json_repair.loads("""{    "a": "",    "b": [ { "c": 1} ] \n}```""")
# This will raise exception TypeError: unhashable type: 'list'

It seems the TypeError exception is not related to the trailing texts, considering:

json_repair.loads("""{    "a": "",    "b": [ { "c": "1as\\\\df"} ] }""", skip_json_loads=True)