#22 · Primary category: NLP Tools & Text Processing

json_repair

cli json json-repair json-schema llm llm-output malformed-json parser pydantic python streaming structured-output

Repair malformed JSON from LLMs, APIs, logs, and user input in Python.

Project last updated:08/27/26

GitHub Stars

5.1K

Forks

214

Contributors

20

License

MIT

Why we included this project

Large language models are great at producing text and only okay at producing valid JSON. json_repair is a small Python library that cleans up the mess when a model closes a brace too early, drops a comma, or pads the output with a stray sentence. It plugs into existing code as a drop-in replacement for json.loads(), trying strict parsing first and only invoking the repair parser when standard JSON fails. For teams routing LLM output into databases or schema-validated pydantic models, that fallback can mean the difference between a pipeline that runs and one that dies on a parse error every few requests. It is a focused utility, not a framework, so adding it is a one-line install rather than an architectural decision.

Articles for this project

No articles for this project yet.

To suggest a topic or contribute an article, contact us.

Related projects in this category