JSON Repair

    Fix malformed JSON and see exactly which repairs were applied.

    Broken JSON
    Repaired JSON
    • Removed comments
    • Converted single-quoted strings to double quotes
    • Added quotes around unquoted keys
    • Replaced Python/JS literals with JSON equivalents
    • Replaced NaN/Infinity with null
    • Removed trailing commas

    How to Repair Broken JSON

    1. 1

      Paste the broken JSON

      Drop in whatever failed to parse — a config file, a copied log line, an LLM response or hand-written payload.

    2. 2

      Read the repair list

      Every fix is listed above the output, so you can see whether the change was safe before you trust it.

    3. 3

      Check the result

      The output is reparsed and reformatted, so if it appears at all it is valid JSON. If the input is too damaged, you get the specific parse error instead.

    4. 4

      Copy it back

      Copy the repaired document into your file or request. Nothing is uploaded at any stage.

    Frequently Asked Questions

    The parser reached a character that cannot appear at that point. The usual causes are a trailing comma before a closing brace or bracket, a single quote where JSON requires a double quote, an unquoted key, or a stray comment. All four are repaired automatically here.

    Single-quoted strings, unquoted object keys, trailing commas, // and /* */ comments, Python literals (True, False, None), undefined, NaN and Infinity, smart quotes pasted from a document, literal newlines inside strings, a wrapping Markdown code fence, a byte-order mark, unterminated strings, and unclosed brackets or braces.

    Yes. The repair runs entirely in your browser with JavaScript — nothing is uploaded, logged or stored. That is the point of doing it client-side rather than through an API.

    JSON is an interchange format, not a language. It deliberately forbids comments, trailing commas, single quotes and unquoted keys so that every parser in every language agrees on exactly one interpretation. JavaScript object literals are more permissive because they are code, not data.

    It strips a surrounding Markdown code fence and repairs the common syntax slips, which covers most model output. If the response contains explanatory prose outside the fence, delete that first — the tool repairs syntax, it does not guess which part of a document you meant.

    It changes syntax, not values, with two exceptions worth knowing: NaN and Infinity have no JSON equivalent and become null, and undefined becomes null. Both are listed in the repair log when they happen.

    Related Tools