JSON Repair Tool

Auto-fix malformed JSON strings, JS object literals, python dicts, and truncated LLM output blocks.

100% Client-Side (No data leaves your device)
Input (Malformed or Dirty JSON)
0 chars
1
Output (Repaired JSON)
1
Repaired standard JSON will appear here...

User Guide: How to Auto-Repair Malformed JSON

Why Do Large Language Models (LLMs) Output Broken JSON?

Generative AI models like ChatGPT, Claude, and Gemini frequently output malformed JSON due to token limits, truncation, or conversational wrappers. Typical issues include single quotes instead of double quotes, trailing commas, python variables like True, None, or conversational text surrounding the code blocks. The JSON Repair tool parses and cleans these errors instantly in your browser.

How to Repair Malformed JSON

  1. Paste text: Insert your raw text, markdown blocks, or truncated code into the Input panel. You can also click Load Broken Sample to try a typical malformed LLM response.
  2. Repair: Click Auto-Repair JSON. Our JS engine will sanitize quote markings, wrap unquoted keys, remove comments, convert literal booleans, and close unclosed brackets.
  3. Review & Format: Read the pretty-printed formatted JSON in the Output panel. Toggle Sort Keys if you want alphabetical ordering.
  4. Copy or Download: Click Copy Output to copy standard JSON to your clipboard, or Download JSON as a file.

Key Features of Our Engine

  • Markdown Stripping: Automatically extracts JSON from inside ```json ... ``` wrappers and conversational text.
  • Token Cutoff Recovery: If the JSON got cut off mid-way, it auto-detects unclosed brackets and correctly appends the missing braces.
  • Key/Quote Restoration: Fixes missing quotes around keys and converts single-quoted strings to standard double quotes.

Before & After Example

Dirty Input (conversational prefixes & unquoted keys):
Here is the data:
{
  name: 'John',
  active: True,
  items: ['a', 'b',]
(cutoff...)
Repaired Standard JSON:
{
  "name": "John",
  "active": true,
  "items": [
    "a",
    "b"
  ]
}