5 ms·
Show HN: I made a tool which fixes broken JSONs
- dstala 3y agoWouldn't it be easier if we ask chatGPT to fix?
- prakhar897 3y agoThe problem is created largely because ChatGPT responses are unreliable. and tokens are expensive.
- luckman212 3y agoI have a simpler thing I do with a wrapper around jsonlint. Just pass a filename and it opens my editor (Sublime) right to the line and column of the error. https://github.com/luckman212/json-lint-sh https://github.com/luckman212/json-lint-sh
- blini2077 3y agoThis is useful, I often have this problem too
- Tazcollings 3y agoI like such professional and compact tools. Doing one thing and doing it well.
- genier200 3y agoNice tools,Thanks.and does the broken json repaired by ai?
- prakhar897 3y agoNope. I’ve written a custom parser to manually handle possible cases.
- cebert 3y agoThis should likely have a disclaimer that JSON you paste into the tool can be stored. I was intentionally providing bad input and was presented with a message, “Sorry, I couldn't parse this JSON. I've logged it and will try to add it to the list of use-cases. Please let me know if this error persists.”
- JoeyBananas 3y agoIt would be your fault for trusting a random website
- prakhar897 3y agoIt doesn’t. That’s just a placeholder message for now :)
- ryebread777 3y agoSeems useful as I do occasionally get broken JSON from LLM responses and would like an easy solution to that. However, I don't see this as something I would use an API for. Especially seeing the supported fixes are relatively simple. Seems like it should be a python package. Maybe if you could somehow handle a comparison with a pre-specified json schema that would make it more valuable.
- mstudio 3y agoVery cool! One note: the random sample marked: 'Using a string "true" instead of a boolean true' leaves "true" as a string after parsing, instead of converting to an actual boolean.
- tbiehn 3y agoJust imagine if we didn’t use heuristics to fix arbitrary inputs and instead we used some sort of learning algorithm that was trained on producing valid looking json - then all we’d need to do is add a prompt and start with some random noise… :P
- prakhar897 3y agoI've written a parser to handle all the cases. I can add a custom model/LLM if the parser fails to improve reliability even further if parser fails. I believe ML Algos are a blackbox and non deterministic. So, they might fail for any given input and can't be trusted as a primary source of truth.