OpenViSTAI · Agents · Blockchain · Crypto
Menu
AI Developer Tools & SDKs

Json Repair

Json Repair is an open-source Python library and command-line tool for repairing malformed JSON, including output from LLMs, APIs, logs and user input. It can return repaired JSON text or a decoded object, and its default loading call first attempts strict parsing before using its repair parser.

Independent OpenViST project profile, based on linked sources.

Json Repair — OpenViST project profile in AI Developer Tools & SDKs.
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use it when a Python application or command-line workflow needs to process JSON-like text that may contain syntax errors or extra non-JSON content. Its default loading call can also handle already-valid JSON by trying strict parsing first.

Who it is for

  • Python developers handling LLM-generated structured output.
  • Developers processing JSON-like input from APIs, logs or users.
  • People who need a command-line option for malformed JSON.

Documented uses

  • Recover a decoded object from JSON text that fails strict parsing.
  • Repair common syntax issues such as missing quotes, commas or brackets, comments and truncated values.
  • Read JSON from a file or file descriptor through the documented file-loading methods.
  • Preserve non-Latin characters in repaired output by setting `ensure_ascii=False`.
Before you choose

Requirements & limits

The repository identifies the project as open source under the MIT license. It documents installation with pip and provides a live demo.

  • Python 3.10+ is indicated by the repository’s Python-version badge.
  • The default loads() flow attempts strict parsing before repair; the initial check can be skipped explicitly when input is already known to be invalid.
  • File-loading methods do not catch I/O exceptions, which the calling code must handle.
  • For non-Latin characters, the documentation recommends ensure_ascii=False with repair_json() to keep characters unescaped.
  • The project describes schema-guided repair, but detailed schema-guided instructions are not included here.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Install the library and repair a JSON string

Install Json Repair and pass a malformed string to its documented Python loading function.

Before you start

  • Python 3.10 or later, as indicated by the repository badge.
  • pip and the json-repair package.

Steps

  1. Install the package with the command below.

    Documented command
    pip install json-repair
  2. Import json_repair in Python.

  3. Pass the input string to json_repair.loads() to obtain a decoded object; by default, the library tries strict JSON parsing before falling back to repair.

Expected outcome

A decoded object from input that may require repair, or a strict parse result when the input is already valid JSON.

Guide limitations

  • The documented example does not define a guarantee for every malformed input.
  • For known-invalid input, the documentation allows explicitly skipping the initial strict validation step.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
7 October 2026
Original website title
mangiucugna/json_repair · Official homepage title · retained in its source language