json

FormatValidateConvert

Start over?

This clears both panes. Unsaved changes in either document are lost.

Replace that document?

This writes the matches into the other pane. What is there now is lost.

Load JSON from a URL

Your browser fetches it directly — the request goes to that site, never to us.

    ↑ ↓ to move · Enter to run · Esc to close

    Keyboard shortcuts

    Send feedback

    Questions, bug reports and feature requests are all welcome. A bug report is easiest to act on with the shape of the document that caused it — never send anything confidential.

    Email us

    Contact page, in a new tab, so this page stays as it is.

    Settings

    Indent

    Format and Sort keys write it, and Tab in Code view types it.

    Code text size
    14 px

    Code view and generated code.

    Wrap long lines
    Left pane opens in
    Right pane opens in

    In a new tab and after New. A view you choose in a pane is still remembered.

    JSON Repair

    On the left pane · one documentOn one document
    0
    0

    About JSON Repair

    JSON Repair: fix broken JSON in your browser.

    Your document never leaves the browser.

    Turn nearly-JSON into JSON with one explicit, undoable press, in the same private workspace as the JSON editor. To see where a document is broken before you fix it, use the JSON Validator; to check generated data against a contract, use the JSON Schema Validator. Holding an error message rather than a document?JSON error messages explains each runtime's wording and whether Repair can help.

    What JSON Repair fixes

    1

    Before

    {
      // model output
      name: 'Ada',
      active: True,
    }
    2

    After

    {
      "name": "Ada",
      "active": true
    }
    3

    Repaired

    Removed trailing commas
    Quoted bare property names (2)
    Converted single-quoted strings
    Converted Python literals
    Removed comments

    Most text that a JSON parser rejects was nearly right. It is an object copied out of a JavaScript file, a dictionary printed by a Python shell, a configuration file with comments in it, or a download that stopped part-way. This page opens with Code view ready: paste the text, and the Repair button in the pane toolbar turns amber while the document does not parse. Press it, or the same button in the band above the editor, and the text is rewritten into JSON that a strict parser accepts.

    The example above is small but typical. It has a comment, two property names without quotes, a single-quoted string, the Python spelling True and a comma after the last member. One press fixes all five, and the status bar reads Repaired followed by the list printed under the example, one entry per kind of change. The full catalogue goes further. Line and block comments are removed along with the line they stood on. Backticks and the curly quotes a word processor inserts become straight double quotes. Bare values are quoted, and stray or missing commas and missing colons are corrected. NaN, Infinity and undefined, which JSON has no way to spell, become null. Invalid escapes and raw control characters inside strings are escaped, and a byte-order mark or an anti-hijacking prefix is dropped. Several top-level values on consecutive lines, as a log file writes them, are wrapped in one array.

    What Repair does not do is reformat. It makes one careful pass from left to right that always knows whether it is inside a string, copying your text through and changing only the broken parts. Indentation, blank lines and key order stay as you wrote them, so fixing one missing comma in a two-thousand-line file changes one line of it. Because the scanner tracks strings, a URL containing two slashes is not mistaken for a comment and an apostrophe inside a double-quoted sentence is not mistaken for a quote. That is exactly where search-and-replace fixes go wrong.

    What Repair refuses, and why

    A repair tool that always returns something is dangerous, because a plausible document that is not the one you meant is worse than an error message. Repair therefore refuses whenever the honest answer would be a guess. Ordinary prose with a pair of braces somewhere in the middle is left alone: pulling an object out of arbitrary text is how an HTML error page gets turned into something that looks like data. The status bar says Nothing here could be repaired automatically, and your text is untouched.

    Code fences get more specific answers. When a reply holds two JSON code blocks, Repair will not choose between them, since a model that shows a before and an after means neither to be the whole document; the message asks you to delete all but the one you want. A block marked as another language, such as yaml, is refused by name, and so is an empty block. For YAML, XML or CSV, the Convert page reads those formats properly instead of forcing them through a JSON repair.

    Every repair is checked again after the fact. The rewritten text is parsed before it may replace yours, and if it still does not parse, nothing changes: the status bar says the remaining errors are marked in the editor, where Code view underlines each one. Writing a half-repaired document would only move the problem somewhere new. An empty pane is not broken either, and Repair leaves it empty rather than inventing a null.

    Repair JSON from an LLM response

    Ask a language model for JSON and the answer often arrives dressed for a chat window: a sentence of introduction, a Markdown fence marked json, the document, and perhaps a closing remark. If the model ran into its token limit, the document simply stops, halfway through a string or with several brackets still open. A strict parser rejects all of it at the very first character.

    Repair recognises that shape. It finds the one fenced block marked as JSON, JSONC, JSON5, JSONL, NDJSON, GeoJSON or JavaScript, drops the conversation around it, and repairs what is inside. Output cut off at the end is closed the way the model would have closed it. An unterminated string gets its closing quote and open arrays and objects are closed in order. A literal that stopped at tr becomes true, a half-written property name is dropped, and a number cut short is completed. The status bar says which of those it did, so a truncated answer never passes quietly as a complete one.

    Closing a truncated answer makes it parse; it cannot restore what the model never wrote. The last record may be missing fields, and an array may be shorter than you asked for. Look at the end of the repaired document in Tree or Table view, and ask again with a smaller request or a higher limit when the missing part matters. When generated data has to match a contract, the JSON Schema Validator checks the repaired result against your schema and marks every value that breaks it.

    A worked guide to fixing invalid JSON

    The guide below takes one broken configuration file and fixes it step by step. It starts by counting the problems the parser can see, then repairs the file in the editor, shows what the repair deliberately left alone, and explains how to read the list of fixes. Its sibling pages in the Repair guide cover AI answers, values written in other languages, log lines and the inputs Repair refuses. Each one is built on an example that the site runs through the real engine in its tests, so what the guide shows is what you will see.

    Read Fix invalid JSON: comments, quotes and commas, or browse the whole Repair guide.

    Undo it, then format it

    Repair lands as a single change in the undo history. One press of Cmd+Z on a Mac, or Ctrl+Z on Windows and Linux, restores the text exactly as you pasted it, so trying Repair to see what happens costs nothing. Once the document parses, the rest of the editor is available: Format lays it out with the indent you choose, Minify puts it on one line, Tree and Table views show its structure, and Compare sets it beside another version.

    Everything happens in this tab. The repair engine is written for this site and ships inside the page you loaded, rather than being a call to a remote service, so a configuration file holding credentials or a customer record from a support ticket stays on your machine. After the first load, Repair keeps working with the network disconnected.

    FAQ

    Frequently asked questions

    Didn’t find your answer?Write to us on the contact page →
    What kinds of broken JSON can Repair fix?

    The near-JSON people meet every day: comments, single or curly quotes, unquoted keys, trailing and missing commas, Python and JavaScript values such as None, True, NaN and undefined, a Markdown fence around an AI answer, output that stops mid-document, and one record per line from a log. The status bar names every category it changed, with a count where there was more than one.

    Does JSON Repair change valid JSON?

    No. While the document parses, the Repair button is unavailable and its tooltip says there is nothing to fix. On broken input it rewrites only the broken spots, so the valid parts keep their spacing, their member order and the exact spelling of every number.

    Why does Repair refuse some input?

    Because a confident wrong answer is worse than no answer. When the only way forward is to pick one of two code blocks, lift braces out of a paragraph, or accept a result that still fails to parse, Repair leaves your text exactly as it was and tells you why in the status bar.

    Is my broken JSON uploaded?

    No. The repair engine is part of the page itself and runs inside this browser tab, so nothing you paste is sent to a server or logged anywhere. Once the page has loaded it works offline as well.