-
Notifications
You must be signed in to change notification settings - Fork 44.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(json_parser): remove the tab character that can be present in the… #260
fix(json_parser): remove the tab character that can be present in the… #260
Conversation
… generated json. It makes the json.loads function throw an Invalid JSON error
Is this why we fail to parse JSON so often? |
@dschonholtz Because I run the continuous mode in debug for 1 hour, and stored all string that cause invalid JSON error. There is only 2 cases. This one (the tab character), and this one #256 caused by the presence of unwanted commas (due to mis interpretation of gpt3.5 being a python function). When I had the strings which caused the error, I tried the string is this tool: https://jsonformatter.curiousconcept.com/ , and by trial and error, the string ended up being valid when I removed a tab inside one of the JSON string value. An hexidecimal editor helped me to see that the space I was removing was a TAB character. To be sure, I tested the code the fixed and faulty string with project code and confirmed it fixed the issue. Here is the JSON that caused the error:
give this string to the json.loads function, it will fail. After merging this, since the json_fixer will always be successful, it will cause another error that I corrected here: #259 |
I sugggest logging the errors and messages who caused it in a error.log, it will highly decrease the debugging time this improve the overall quality of the project |
Wow. That's what I like to see, excellent work @fabricehong! |
Signed-off-by: Merwane Hamadi <merwanehamadi@gmail.com>
remove the tab character that can be present in the generated json. The tab character makes the json.loads function throw an Invalid JSON error.