Learn

How to fix invalid JSON

Direct answer: Invalid JSON is usually caused by trailing commas, missing commas between properties, single quotes, comments, or truncated responses. Fix by locating the first parse error, correcting syntax, then re-validating. BracketView can attempt local repair and optional AI repair when local fixes fail.

Step-by-step

  1. Step 1

    Read the parser error

    Note the line/position of the unexpected token.

  2. Step 2

    Apply common fixes

    Add missing commas, remove trailing commas, convert single quotes, strip comments.

  3. Step 3

    Use AI repair if needed

    For large or messy dumps, run Fix JSON / AI repair, then re-validate.

Examples

Trailing comma (invalid)

{
  "a": 1,
}

FAQ

Why do APIs return invalid JSON?

Proxies may truncate bodies, loggers may concatenate lines, or serializers may emit JS-like objects with trailing commas.

Try it in BracketView