mangiucugna/json_repair

[Bug]: loading an ordinary string results in empty string object

Closed this issue · 1 comments

Version of the library

0.25.3

Describe the bug

Hi there!

Just upgraded from v0.13 to current release and found that loading a raw string does not work anymore:

>>> json_repair.loads('test')
''

I expected

>>> json_repair.loads('test')
'test'

as a fallback. This breaks my setup as I now have to check myself somehow if parameter is just a raw string without any JSON object definition. Is this a bug or are there any good reasons for that change?

Thanks!

How to reproduce

json_repair.loads('test')
''

Expected behavior

json_repair.loads('test')
'test'

hi! Thanks for reporting but this is not a bug.
A plain string without quotes is not a valid JSON string and it is ignored by the library to cover for cases like this:
Sure here's your JSON {"key":"value"}

So this behavior is a feature not a bug