PrettyJSON Logo
PrettyJSON

Instantly clean, validate, and inspect web payloads

Sample Payloads
Buy me a coffee
Raw JSON Input

Waiting for JSON content

Start typing on the left or load one of the sample payloads to inspect it instantly.

RFC 8259 Compliant & 100% Client-Side

Fix Broken JSON Online — Auto-Repair & Error Fixer

Automatically fix broken JSON online. Auto-repair single quotes, missing key quotes, trailing commas, JavaScript comments, Python literals, and AI/LLM output errors.

Private & Offline Ready

Every tool runs in your browser, so the JSON you paste never leaves your device.

Works Instantly, Even Offline

Formatting, minifying, repairing, and the tree view all run on your device, so there are no uploads to wait on.

Exact Error Line & Column

Syntax errors like unescaped quotes and trailing commas are flagged with their exact line and column.

How JSON Repair Fixes Common Mistakes Automatically

The everyday problems that break JSON and how the repair tool fixes them while keeping your data intact.

1. What Broken JSON Usually Means

Most JSON that fails to parse is not badly broken — it is real data with a few small problems. You copy a Python dictionary, a JavaScript object, or a truncated line from a log, and it almost looks like JSON but breaks the strict rules. The PrettyJSON repair tool works through these common problems in order and turns the input into valid JSON, keeping your keys and values as they are. It runs entirely in your browser, so nothing you paste is uploaded.

Technical Highlights

  • Most invalid JSON has only a few small, common problems.
  • Repair fixes those problems while keeping your data unchanged.
  • Runs locally in your browser.

2. Quotes and Keys

Two of the most common problems are single quotes instead of double quotes, and keys with no quotes at all — both are normal in JavaScript and Python but invalid in JSON. Repair converts single quotes to double quotes and adds quotes around unquoted keys, while being careful not to change quotes that appear inside string values. Python-style values like True, False, and None are converted to true, false, and null.

A Repair Example
// Input (JavaScript / Python style)
{ id: 101, 'user': 'Alice', active: True, tags: ['dev',], }

// Repaired (valid JSON)
{
  "id": 101,
  "user": "Alice",
  "active": true,
  "tags": [
    "dev"
  ]
}
Explanation: Unquoted keys get quotes, single quotes become double quotes, True becomes true, and the trailing comma is removed.

3. Comments, Trailing Commas, and Missing Brackets

JSON does not allow comments or a comma after the last item, but both sneak in constantly when JSON is copied out of code. Repair removes line and block comments and strips trailing commas from objects and arrays. It also handles truncated data: if a response was cut off and is missing its closing brackets or braces, repair adds the missing ones in the right order so the structure is complete again.

Technical Highlights

  • Removes line and block comments that are not valid in JSON.
  • Strips trailing commas from objects and arrays.
  • Closes missing brackets and braces on truncated data.

Frequently Asked Questions

Common questions and expert answers regarding this tool.

What does the JSON Repair tool fix?

It fixes the common problems that break JSON: single quotes, unquoted keys, comments, trailing commas, missing closing brackets, and Python values like True, False, and None. Your keys and values are kept as they are.

Can it turn a Python dictionary into valid JSON?

Usually, yes. Python dictionaries often use single quotes and True, False, or None. Repair converts the quotes and those values so the result is valid JSON.

What if there are extra characters or a truncated response?

Repair strips wrapping junk around the JSON and, if the data was cut off, adds the missing closing brackets and braces so the structure is complete again.