json_repair and partialjson
These are competitors—both parse and repair malformed JSON from LLM outputs, with json_repair offering more mature adoption while partialjson specializes in handling partial/streaming JSON responses.
About json_repair
mangiucugna/json_repair
A python module to repair invalid JSON from LLMs
Provides syntax error correction for common LLM output mistakes—missing quotes, unescaped characters, incomplete arrays/objects—while preserving content integrity. Uses a two-stage approach: first attempts standard library `json.loads()` for performance, then falls back to a custom repair parser only on failure. Offers drop-in replacements for `json.load()` and `json.loads()`, with optional `skip_json_loads` and `strict` modes for performance tuning and validation control.
About partialjson
iw4p/partialjson
+1M Downloads! Repair invalid LLM JSON, commonly used to parse the output of LLMs — Parsing ChatGPT and llm JSON stream response — Partial and incomplete JSON parser python library for OpenAI | repair invalid JSON, parse output of LLMs
Related comparisons
Scores updated daily from GitHub, PyPI, and npm data. How scores work