JSON Fixer is a tool to fix broken JSONs. I dealt with a lot of broken JSONs at times and wished a tool like this existed, so I created one for myself.
A lot of people use Large Language Models (LLMs) like ChatGPT, Claude, etc. to get JSON responses. These responses are at times broken. Each response has a chance of being broken in a different way, so a generic fixer might help.
Also when printing Python dicts, Python JSONs, Java stringifys, etc., they inadvertently add a lot of extra information to the JSON. This tool fixes the JSON created by them too.
I started with a few examples of broken JSON and wrote regex to fix them. This approach was quickly hacked by internet people.
So, I wrote a huge state machine like architecture for each state and how to handle it. Then wrote a custom engine based upon it.
The logic engine still fails for 20% of the queries. So, I also added LLMs to the mix for even better results.
There are a few ways to identify if your JSON is broken. It might not display correctly in a JSON viewer, or you might encounter errors when trying to parse it in your code. Online JSON validators can also help diagnose issues.
JSON Fixer can handle most commonly formatted JSON data, including objects, arrays, strings, numbers, booleans, and null values.
If JSON Fixer encounters an issue it can't handle, it will display an error message indicating the problem's location in the JSON data. You can then manually address the error or use a different JSON fixing tool.
While JSON Fixer can address many common JSON issues, it's important to note it might not be able to fix severely corrupted data. Additionally, complex formatting issues might require manual intervention.