JSON validator and fixer

Check JSON for errors, see exactly where it breaks, and automatically fix the mistakes AI models often make, such as code fences, trailing commas and single quotes.

    How to use it

    1. Paste the JSON, or the whole AI reply that contains it.
    2. Leave "Fix common AI mistakes" on to repair it automatically, or turn it off to check strictly.
    3. Pick an output style and copy or download the result.

    Why AI models break JSON

    Language models write JSON one token at a time, the same way they write prose. They have seen a lot of JavaScript, Python and Markdown, so habits from those formats slip in. The result often looks fine to a person but fails in a strict parser. The most common problems are:

    • The JSON is wrapped in a Markdown code fence such as ```json, or preceded by a sentence like "Here is the data:".
    • A trailing comma after the last item in an object or array.
    • Single quotes instead of double quotes around keys or strings.
    • Curly "smart" quotes instead of straight quotes.
    • // comments or /* comments */, which JSON does not allow.
    • Python values such as True, False and None in place of true, false and null.

    What the fixer does

    With fixing on, the tool first pulls out the JSON from the surrounding text, then repairs each of the problems listed above, taking care not to change anything inside string values. It tells you which repairs it made, so you can see whether the original output had an issue worth fixing at the source. If the JSON still fails after repair, the error message gives the line and column and points at the character where the parser stopped.

    Worked example

    A model asked to extract listing details replies with: Sure! ```json {'unit': 'A-12-3', 'furnished': True, 'price': 2800,} ```. A strict parser rejects it on the first character. The fixer removes the chat text and the fence, converts single quotes to double quotes, changes True to true, and drops the trailing comma, producing valid JSON ready for your spreadsheet or app.

    Formatting options

    Pretty print adds line breaks and indentation so a person can read it. Minify removes all optional whitespace, which makes the file smaller and is the usual choice when sending JSON to an API. The summary also shows the number of keys and how deeply the data is nested, a quick way to spot a missing or extra level.

    Preventing the problem

    Most AI providers now offer a structured output or JSON mode that constrains the model to valid JSON matching a schema you supply. Use it when you can. In your prompt, show an exact example of the object you want and say "Reply with JSON only, no explanation". The prompt builder has a data extraction preset that does this.

    Questions

    Is my JSON uploaded anywhere?

    No. Parsing and repair run in your browser, so it is safe to check API responses and internal data.

    Will the fixer change my data?

    It only changes syntax: quotes, commas, comments, code fences and Python-style literals. Text inside string values is left as it is. Turn the fixer off if you want a strict check only.

    What standard does it follow?

    The strict check uses your browser's built-in JSON parser, which follows the JSON standard (RFC 8259).

    Can it fix truncated JSON?

    Not reliably. If the model stopped mid-way, data is missing and should be regenerated, usually with a higher output token limit.