Closed jenniferhaefner closed 9 months ago
I have removed the GPT generated comment, blimey what a world we live in eh
Second, good catch! I will add the string to the tests and solve the loop, an empty string is in fact a valid key in JSON (weird eh?)
no sorry, I need to use a placeholder or it will break when returning an object
These are the two tests added:
assert {
repair_json('{"" : true, "key2": "value2"}') == '{" ": true, "key2": "value_2"}'
}
assert {
repair_json('{"": true, "key2": "value2"}') == '{"empty_placeholder": true, "key2": "value_2"}'
}
I will release 0.5.1 now with this fix
Great, thank you!
Hi, first of all, thanks for this very useful library! My model occasionally produces JSON strings with empty keys, so I encountered the following issue:
Describe the bug When a key in the JSON string is empty, the library runs into an infinite loop in 'parse_object'.
To Reproduce Steps to reproduce the behavior:
Expected behavior Either return 'Invalid JSON format' or substitute the empty key? Not sure what's best here