JSON Validator
Check whether a document is syntactically valid JSON. You get the parser's message, the location it stopped at, and a summary of the structure it found — without changing a single character of your input.
Runs entirely in your browser — your JSON is never uploaded.
A worked example
A validator is most useful when it tells you where the parser stopped and what to change first.
Input
{"name":"Ada","skills":["json"],}Output
Error: Expected double-quoted property name
Position: 31 (line 1, column 32)
Cause: trailing comma before }The exact wording depends on the browser engine. This tool reports the position from the parser that ran in your browser.
How to validate a document
- Paste the document into the editor, or load one of the two samples: a valid configuration file and a broken one with a trailing comma.
- Press Validate JSON. The result replaces the placeholder below the editor.
- If the document is valid, a structure summary shows its top-level type, nesting depth and how many values were parsed.
- If it is not, the parser message is shown with the line and column where parsing stopped, the offending line of source, and possible causes.
Turning on Check as I type re-validates automatically after a short pause. It is disabled for documents above 100,000 characters so typing stays responsive.
Validator or formatter?
Both tools parse the document, so both catch syntax errors. The difference is what happens next. The formatter rewrites your text into an indented version, which is what you want when the goal is readability. This page never rewrites anything: it answers a yes/no question and, when the answer is no, explains what the parser objected to.
That makes it the better choice when you are debugging a payload from a log file or a failing request, where you care about the error and not about the formatting.
The rules a document has to follow
- One top-level value. An object, array, string, number, boolean or null — but only one, with nothing but whitespace around it.
- Double quotes only. Strings and property names must use straight double quotes. Single quotes and smart quotes are rejected.
- No trailing commas. A comma separates members; it must not follow the last one.
- No comments. JSON has no // or /* */ syntax. JSONC and JSON5 exist as separate formats.
- No bare words. NaN, Infinity, undefined and function calls are not values in JSON.
- Escaped control characters. A literal newline inside a string is invalid; use \n instead.
What the parser actually says
These are the messages Node.js 22 (V8) produced for each input below. They were captured by running the snippets, not paraphrased. Chrome uses the same engine, so you will usually see this exact wording; Firefox and Safari phrase things differently but stop at the same character.
| Input | Message | What it means |
|---|---|---|
| {"a":1,} | Expected double-quoted property name in JSON at position 7 (line 1 column 8) | Trailing comma. After the comma the parser still expects another member. |
| [1,2,] | Unexpected token ']', "[1,2,]" is not valid JSON | The same mistake in an array — and this time no position is reported at all. |
| {a:1} | Expected property name or '}' in JSON at position 1 (line 1 column 2) | Unquoted key. A single-quoted key produces exactly the same message. |
| {"a":1 // note} | Expected ',' or '}' after property value in JSON at position 7 (line 1 column 8) | The comment is seen as unexpected characters after a complete value. |
| {"a":1 | Expected ',' or '}' after property value in JSON at position 6 (line 1 column 7) | Reported at the last character, but the missing brace is the real problem. |
| {"a":1}{"b":2} | Unexpected non-whitespace character after JSON at position 7 (line 1 column 8) | Two top-level values. A JSON document holds exactly one. |
| {"a":NaN} | Unexpected token 'N', "{"a":NaN}" is not valid JSON | NaN is a JavaScript value, not a JSON one. |
| {"a":1} | Unexpected token '', "{"a":1}" is not valid JSON | A UTF-8 BOM sits in front of the brace. The character between the single quotes is U+FEFF, which renders as nothing — that is why the message looks like it is complaining about a blank. |
| undefined | "undefined" is not valid JSON | No “Unexpected token” prefix at all: V8 quotes the whole input instead. A variable that is still undefined reaches JSON.parse this way more often than a typo does. |
Look at the second row: the engine reported no position at all, it only echoed the document back. That single detail explains a design choice on this page — when the message carries no location, a strict scanner re-reads the document with the same grammar rules and reports the first offset where it cannot continue. Locations found that way are labelled approximate, because at the exact boundary character two different readings can both be defensible.
Captured on 21 October 2026 with Node 22.22.2. Messages are not part of any specification, so they can change when an engine is updated.
Reading a parser error
A strict JSON parser stops at the first byte it cannot accept. That is why the reported position often points slightly after the real mistake: a missing comma is only noticed when the parser meets the next key, and an unclosed brace is reported at the end of the file.
The usual order of investigation is: look at the reported line, check the character before the reported column, then walk outwards to the enclosing block. If the message mentions the end of the input, the problem is an unmatched opening brace, bracket or quote rather than the last line itself.
Browsers do not agree on error wording, and the same document can produce different messages in Chrome, Firefox and Safari. The line and column shown here come from your browser and are best treated as a pointer.
If you want the long version — what each message means, why some carry no position at all, and the nine causes behind almost every failure — read JSON parse error messages, decoded.
Two specific cases get their own write-ups, because the messages mislead in different ways: a failure at position 0 means the response was never JSON — it was an HTML error page, an app shell or a login redirect — while trailing commas and comments mean the file came from a JSONC or JSON5 reader.
Why a structure summary helps
A document can be perfectly valid and still be wrong: an empty array where you expected data, a depth of twelve where you expected three, or 4,000 values where you expected 40. The summary shows those numbers immediately, which is often faster than scrolling through a collapsed tree in your browser's developer tools.