Skip to content
cosmodev ~/tools/json-repair

Pembaikan JSON

AI & Agents

Baiki JSON yang rosak — koma berlebihan, petikan tunggal, kunci tanpa petikan, komen, pemalar Python, BOM dan dokumen terpotong — dan dapatkan JSON bersih tercetak cantik serta senarai setiap pembaikan yang diterapkan. Berjalan sepenuhnya dalam pelayar anda.

Cuba:
JSON dibaiki
Taip atau tampal JSON rosak untuk dibaiki.

(Documentation in English)

What it does

Turns broken-but-salvageable JSON back into valid JSON. Paste text that a strict parser rejects - trailing commas, single quotes, unquoted keys, // or /* */ comments, Python’s True/False/None, a copied-in BOM or zero-width characters, or a document cut off mid-way - and get clean, pretty-printed JSON back. Every repair pass that fired is listed by name, so you can see exactly what was changed and why. If the input already parses, the tool says so and simply pretty-prints it. Everything runs locally in your browser; nothing you paste is sent anywhere.

This is the daily companion of anyone who moves JSON between languages and tools: LLM output that slipped into Python or JavaScript habits, config files pasted out of a notebook, log lines truncated mid-object.

How to use it

  1. Paste broken JSON into Broken JSON, or tap Sample for a document that exercises several repairs at once. Clear empties the box.
  2. Tap a chip below the input to try a headline case: trailing comma, single quotes, truncated array, unquoted keys.
  3. Read the badge: Repaired (green, changes were made), Valid JSON (green, input already parsed), or Unrepairable (red, the parser error is shown).
  4. When repaired, read Repairs applied (N) - one bullet per pass that changed your text - then copy the result with Copy repaired JSON.
  5. Copy share link encodes your input in the URL (?j=...), so a link reproduces the exact view.

Examples

A trailing comma:

{"host": "localhost", "port": 8080,}

Result: Repaired, 1 repair applied (Removed trailing commas), output:

{
  "host": "localhost",
  "port": 8080
}

A Python-flavored dict (single quotes plus True):

{'name': 'CosmoDev', 'open': True}

Result: Repaired, 2 repairs applied (Converted single quotes to double quotes, Converted Python constants (True/False/None)), output:

{
  "name": "CosmoDev",
  "open": true
}

A truncated array (log line cut off mid-object):

{"list": [1, 2,

Result: Repaired, 1 repair applied (Closed truncated brackets), output:

{
  "list": [
    1,
    2
  ]
}

Good to know

  • Passes, in order: invisible characters (BOM / zero-width) → single quotes → comments → unquoted keys → Python constants → trailing commas → truncated brackets. Each pass only fires when it changes something.
  • Repair is best-effort: a document truncated mid-key ({"na) can end in an invalid token and stays Unrepairable - the parser’s error tells you where. Repair also never invents missing data: a value cut off mid-number stays exactly as written.
  • ?j=... links reproduce the exact view; very large documents make long URLs.
  • Private: the tool runs 100% client-side - safe for configs, credentials, and API payloads.
  • Related tools: JSON Validator, JSON Formatter, JSON Minify.
Kod sumber14 languages

100% client-side · your data never leaves your browser. Found this useful? Share it with a teammate.