ToolGenie.org Logo

JSON Validator — Check JSON Syntax Online

Validate JSON online and see the exact error line. Paste a payload, upload a .json file, or load a sample. The checker runs in your browser and never uploads your data.

Everything runs in your browser. Press Ctrl/Cmd+Enter validate.

0 characters · 0 lines · 0 bytes

How to Validate JSON Online

  1. Paste JSON, upload a file, or load the sample.
  2. Click Validate JSON. A green message means the syntax is valid.
  3. If validation fails, jump to the error line and fix the token.
  4. When it is valid, format or edit the payload.

About This JSON Validator

This page checks JSON syntax only. It does not try to rank for every JSON job. If you need to create or rewrite a file, use the JSON editor. If you only want indentation, use the JSON formatter.

The checker uses the browser's JSON parser and maps the failure position to a line and column so “unexpected token” is actionable instead of vague.

Almost every JSON syntax error comes from the same short list, and knowing it turns a five-minute hunt into a five-second fix. A trailing comma after the final element of an object or array is the most common by far, because JavaScript tolerates it and JSON does not. Single quotes around a string are second: JSON requires double quotes everywhere, for both keys and values. Unquoted keys are third — perfectly legal in a JavaScript object literal, illegal in JSON. After those come unescaped line breaks inside a string, a stray comment (JSON has no comment syntax at all), and the values undefined or NaN, neither of which exists in the format.

The error position tells you where the parser gave up, not always where the mistake is. A missing closing brace halfway down a file is usually reported at the very end of the document, because that is the first point at which the parser can be certain something is wrong. When the reported line looks innocent, read upward and check that every bracket and brace you opened has been closed. Formatting the payload first often makes an unbalanced structure obvious at a glance.

It is worth being precise about what this page does and does not check. It confirms that the text is well-formed JSON — that it parses. It does not confirm that the document is the JSON your system expects. A payload can be flawless syntax and still be missing a required field, carry a string where a number belongs, or violate a business rule. That second kind of checking is schema validation, and it needs JSON Schema, an OpenAPI contract, or your own code. Syntax first, schema second; this tool owns the first step.

Validation runs entirely in your browser using the same parser your JavaScript engine uses, which has two consequences worth stating. Nothing you paste is uploaded, so a payload containing credentials or personal data never leaves the machine. And the verdict matches exactly what a browser, a Node service, or any standards-compliant parser will do with the same bytes, so passing here means passing everywhere.

Once the syntax is clean, the rest of the toolkit takes over: beautify it for reading, minify it for shipping, turn it into a TypeScript interface, or export it as CSV for a spreadsheet.

Frequently Asked Questions (FAQ)

How do I validate JSON online?

Paste or upload JSON and click Validate JSON. Valid input shows a success message with size details.

Why do I get unexpected token in JSON?

Usually a trailing comma, single quotes, an unquoted key, or a missing bracket. Jump to the line and inspect the character before the error.

Does this JSON validator upload my data?

No. Validation runs in your browser. Nothing is sent to a server.

Can I validate a JSON array?

Yes. Arrays, objects, and primitive JSON values can all be checked.

Does this tool check JSON Schema, or only syntax?

Only syntax. It confirms the text is valid JSON. It does not validate against a JSON Schema, OpenAPI contract, or custom rules.

What should I do after JSON is valid?

Beautify it, minify it, convert it to CSV or TypeScript, or keep editing in the JSON editor.

Why does the reported error line look correct?

The position marks where the parser gave up, which is not always where the mistake is. A brace you forgot to close halfway down a file is usually reported at the very last line, because that is the first point the parser can be sure something is wrong. Read upward from the reported line and check that every bracket and brace is balanced.

Are comments allowed in JSON?

No. JSON has no comment syntax, so neither // nor /* */ will parse. Some tools accept a relaxed dialect — JSON5, JSONC in VS Code settings, or HJSON — but strict JSON rejects all of them. If you need a note inside the document, add a normal key such as _comment.

Can I use single quotes in JSON?

No. JSON requires double quotes for every string, including all object keys. Single quotes are valid in JavaScript object literals, which is exactly why this mistake is so common when a snippet is copied out of source code.

Are trailing commas valid in JSON?

No. A comma may not follow the final element of an object or array. Modern JavaScript permits it and most editors leave it in place when you delete a line, so it is the single most frequent cause of an unexpected token error.

Is an empty object or an empty string valid JSON?

An empty object {} and an empty array [] are both valid. A completely empty input is not — JSON requires at least one value. A bare string such as "hello", a number, true, false, or null are each valid JSON documents on their own under the current specification.

Does valid JSON mean my API will accept it?

Not necessarily. This page checks syntax only. A document can parse perfectly and still be rejected for a missing required field, a wrong data type, or a value outside an allowed range. That second layer is schema validation and needs JSON Schema, an OpenAPI contract, or your own server-side checks.

Tips for Catching JSON Errors Faster

  • Validate before you convert. CSV and TypeScript tools need valid JSON.
  • Compare a broken snippet with a known-good sample from the JSON examples page.
  • Remember that JSON is stricter than JavaScript object literals.
  • Format the payload in the JSON formatter before hunting a structural error — an unbalanced brace is obvious once the document is indented.
  • Check the character immediately before the reported position, not the position itself. The parser stops one token after the real mistake.
  • Search for a trailing comma first. It causes more unexpected token errors than every other mistake combined.
  • When a snippet was copied out of JavaScript source, expect single quotes and unquoted keys. Both are legal there and illegal here.
  • Validate before every conversion. The CSV and TypeScript tools need a document that already parses, so checking here first saves a confusing failure later.