Skip to content
GigAI Tools
4 tools
Problem → solution

My JSON is invalid and I can't find the error

'Unexpected token' almost always means one stray character. A validator points straight at it so you're not hunting by eye.

The quick answer

When JSON is invalid, a validator finds the exact spot: paste it in and it flags the line and reason, usually a trailing comma, a missing quote or bracket, or single quotes instead of double. Fix that character, then format it to make the structure obvious. Our JSON Validator and Formatter run in your browser on your data.

How to fix it

Follow these steps and you'll have it sorted in a couple of minutes.

  1. 1

    Paste your JSON into the validator

    The JSON Validator parses it in your browser and reports the first error with its line and column.

  2. 2

    Fix the flagged character

    The usual suspects: a trailing comma, an unquoted key, single quotes, or a missing } or ].

  3. 3

    Format to reveal the structure

    Run the JSON Formatter to indent it, mismatched nesting becomes obvious at a glance.

  4. 4

    Re-validate until it's clean

    Repeat until the validator reports valid, then use the Tree Viewer to sanity-check the shape.

Common mistakes to avoid
  • Trailing commas after the last item in an object or array, valid in JavaScript, invalid in JSON.
  • Using single quotes. JSON requires double quotes around both keys and string values.
  • Pasting a JavaScript object or a JSONC file with comments: JSON doesn't allow comments or unquoted keys.

Frequently asked questions

Ready? Start with JSON Validator

Free, private and instant: everything runs in your browser.