200 tools

Code & JSON Tools · · 4 min read

How to Find a JSON Syntax Error by Line and Column

Paste broken JSON into a validator that points to the exact line and column of the error, explains what's wrong, and suggests a fix.

To find a JSON syntax error, paste the JSON into the JSON Validator. It parses the text with the browser's own JSON parser and, if something's wrong, shows you the exact line and column, the broken line with a caret pointing at the problem, and a tip on how to fix it — no guessing which } or , is the culprit.

Why "invalid JSON" errors are so hard to read

Browsers and APIs report JSON errors as something like Unexpected token , in JSON at position 247. That position is a character offset into the whole string — useless if you're staring at a 40-line config file. You end up counting characters by hand, or deleting half the file to narrow it down.

A dedicated validator does that translation for you: it turns the raw parser error into a line number, a column number, and the actual line of text so you can see the problem in context.

How to validate JSON with Toolbench

  1. Open the JSON Validator.
  2. Paste your JSON into the input panel. There are no options to set — it validates as you type.
  3. If it's valid, you get a green ✓ Valid JSON summary with the data's type, key count, nesting depth and size in bytes.
  4. If it's invalid, you get ✕ Invalid JSON, the parser's message, the line and column of the error, the offending line with a ^ under the exact character, and one or more tips for the likely fix.

A real example

Paste this:

{"name": "Toolbench", "tools": 194,}

You get:

✕ Invalid JSON

Expected double-quoted property name in JSON at position 35 (line 1 column 36)

Line 1, column 36:
{"name": "Toolbench", "tools": 194,}
                                   ^

Tips
• Remove trailing commas before } or ].

The caret lands right on the } after the trailing comma, and the tip names the fix directly. Delete the comma before the closing brace and it parses clean.

Now paste valid JSON instead:

{"name":"Toolbench","tools":194,"categories":["text","code","image"]}

You get:

✓ Valid JSON

Type   object
Keys   3
Depth  2
Size   69 B

That summary is a quick sanity check even when your JSON is already valid — if the key count or size looks lower than expected, you probably pasted a truncated payload.

What each tip means

The validator scans the raw text for a few well-known patterns and surfaces a tip for whichever ones it finds:

Pattern it detects Tip shown
A comma right before } or ] Remove trailing commas before } or ].
Single-quoted strings ('like this') Use double quotes — JSON does not allow single-quoted strings.
An unquoted key (name:) Wrap object keys in double quotes.
// or /* */ comments JSON does not allow comments.

These are pattern checks on the text, not a guarantee of the one true cause — if your JSON has more than one problem, fix the one the caret points to first, then re-validate.

Common mistakes this catches

  • Trailing commas after the last item in an object or array — the most frequent cause, especially in hand-edited config files.
  • Single quotes around keys or strings, which is valid JavaScript but not valid JSON.
  • Unquoted keys, also valid in a JavaScript object literal but not in JSON.
  • Comments, which JSON has no syntax for at all.
  • Smart quotes (" " instead of " ") picked up from pasting out of Word, Google Docs or a chat app — these won't trigger a tip, but the caret will land right on one.
  • A missing bracket or brace, usually from copying only part of a response — the key count on a successful validate is a good way to confirm you got the whole payload.

When to use the Formatter or Viewer instead

The JSON Validator is for finding where something breaks. Once your JSON is valid (or you just want to read it), reach for a different tool:

  • Need pretty-printed or minified output, or want keys sorted? Use the JSON Formatter.
  • Want the smallest possible output with no formatting at all? Use JSON Minify.
  • Exploring a large payload and want to click through nested objects and copy a path to a value? Use the JSON Viewer & Editor.
  • JSON copied from a document with curly smart quotes? Run it through the Text Cleaner first, then validate.

Frequently asked questions

Is my JSON sent to a server to validate it?

No. The validator parses your text in your browser using the browser's built-in JSON parser, so nothing in your payload — API keys, tokens, customer data — leaves your device.

Why does the column number sometimes look off by one?

JSON parsers report the position of the character where parsing failed, which is often the character right after the actual mistake (like the closing brace after a trailing comma). The caret marks exactly what the parser reported — if it's pointing at a bracket, check the character just before it too.

Can it validate JSON with comments or trailing commas on purpose?

No, the validator checks strict JSON — the format APIs and config files are expected to use. If you intentionally write JSONC (JSON with comments and trailing commas), use JSON Minify, which has a toggle to allow both.

What does "Depth" mean in the valid-JSON summary?

It's how many levels of nested objects or arrays the data has. A flat object like {"a":1} has a depth of 1; an object containing an array of objects has a depth of 3.

Does the key count include array items?

No. Keys are only counted on objects ({}), recursively through the whole structure. Arrays contribute to the depth and size but not to the key count — only the keys of any objects inside them do.

More guides

All guides →