# mangiucugna/json_repair

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

Repository: https://github.com/mangiucugna/json_repair
Canonical: https://ross.abutalabs.com/products/json_repair
Homepage: https://mangiucugna.github.io/json_repair/
Language: Python
License: MIT
License Family: permissive
Topics: json, llm, parser, cli, json-repair, json-schema, llm-output, malformed-json, pydantic, python, streaming, structured-output
Last push: 2026-08-25T07:38:35+00:00

## Health v2 (maintenance only)
Score: 91/100 (v2, computed 2026-09-03T02:39:23.370411+00:00)
- activity 99, release rhythm 87, longevity 78
- inputs: {"age_days": 1092, "days_push": 8, "days_rel": 8, "gap_med": 4.0, "n_releases_24m": 105}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 5079, forks 214 (observed 2026-08-28T04:09:09.473129+00:00)

## What it is
A Python library that repairs malformed JSON strings, such as broken output from LLMs, APIs, logs, or user input. It works as a drop-in fallback for .loads(), supports schema-guided repair, streaming, and also provides a CLI and online demo.

## Use cases
- parse malformed JSON from LLM responses
- fix broken JSON with missing quotes and trailing commas
- repair truncated JSON from logs or APIs
- validate and coerce JSON against a JSON Schema
- drop-in replacement for .loads on unreliable input
- repair JSON in streaming LLM output

## When to choose
- you consume JSON from LLMs that often emit invalid syntax
- you need a lightweight Python fallback when .loads fails
- you want schema-guided repair and type coercion
- you need to fix JSON from logs, webhooks, or user input

## When to avoid
- your JSON is already well-formed and standard .loads suffices
- you need strict validation that rejects rather than repairs invalid input
- you work outside the Python ecosystem

## Facets
- artifact type: library
- maturity: active
- function: parser, serialization, cli
- domain: large-language-models, developer-tools, parsers, apis
- platform: python, cli, cross-platform
- tags: -repair, llm-output, structured-output, pydantic, -schema, streaming

## Member repositories
- mangiucugna/json_repair (main) score 91

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:09:09.473129+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T18:02:35.764405+00:00, confidence not recorded.
  - readme: https://github.com/mangiucugna/json_repair (fetched 2026-08-28T04:09:09.473129+00:00, sha 57c8dd9170ef)
  - homepage: https://mangiucugna.github.io/json_repair/ (fetched 2026-08-29T08:57:26.483104+00:00, sha 39ca3fd40535)
  - registry_pypi: https://pypi.org/pypi/json_repair/json (fetched 2026-08-29T08:57:26.485697+00:00, sha 031c36b00a5c)
- Data as of 2026-08-30T08:39:29.467469+00:00.
