# json-repair-lite

> Free, MIT-licensed, Python tool (uses the json-repair library; the MCP server also needs the mcp package) that repairs broken or incomplete JSON, including output from language models. Already-valid JSON is left as-is and reported honestly. Runs offline. No API key.

- Install: `pip install git+https://github.com/tidybytetools/json-repair-lite`
- CLI: `json-repair-lite file`. Reads stdin if no file. `--json-lines` treats each non-empty line as its own document. `--json` prints `{"ok": true, "count": 1, "failed": 0, "documents": [...]}`. Exit 0 ok, 1 error.
- Python: `from json_repair_lite import repair_one; repair_one("{name: 'Ada',}")`.
- MCP: `uvx --from git+https://github.com/tidybytetools/json-repair-lite json-repair-lite mcp` exposes two read-only tools: `repair_json_text(text, json_lines=false)` and `repair_json_file(path, json_lines=false)` for local UTF-8 files up to 5 MB.

## Use when
- You have JSON that may be missing quotes, have trailing commas, or be cut off, including output from a language model.

## Don't use when
- You need the tool to invent missing data (it cannot). You need to fetch a file from a URL, or the file is bigger than 5 MB in MCP. Use the Apify version: https://apify.com/tidybytetools/json-repair

## Links
- [README](https://github.com/tidybytetools/json-repair-lite/blob/main/README.md)
- [Apify version](https://apify.com/tidybytetools/json-repair)
