mangiucugna / json_repair

A python module to repair invalid JSON, commonly used to parse the output of LLMs
https://pypi.org/project/json-repair/
MIT License
826 stars 48 forks source link

Exception throw in repair_json.py #15

Closed imsiriuse closed 8 months ago

imsiriuse commented 8 months ago

Exception is thrown after input of specific string

To reproduce: good_json = repair_json(' - { "test_key": ["test_value", "test_value2"] }')

Expected behavior Should convert string ' - { "test_key": ["test_value", "test_value2"] }' into '{ "test_key": ["test_value", "test_value2"] }'

Exception File "...\venv\Lib\site-packages\json_repair\json_repair.py", line 251, in parse_number return int(number_str) ^^^^^^^^^^^^^^^ ValueError: invalid literal for int() with base 10: '-'