Skip to content
DevTinyTools

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.

0 chars
No result yet. Paste a document and press Validate JSON, or turn on “Check as I type”.

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.

Real V8 parser messages for common JSON mistakes
InputMessageWhat 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 JSONThe 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":1Expected ',' 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 JSONNaN is a JavaScript value, not a JSON one.
{"a":1}Unexpected token '', "{"a":1}" is not valid JSONA 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 JSONNo “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.

Frequently asked questions

What does “valid JSON” mean on this page?
It means the text can be parsed by a strict JSON parser as defined by RFC 8259: one top-level value, double-quoted strings, and no trailing commas, comments or unquoted keys. It says nothing about whether the data fits your application's expectations.
Does this check my JSON Schema?
No. This page only checks syntax. Schema validation — required fields, types, string formats, numeric ranges — needs a schema-aware validator and the schema document itself. Treat a green result here as “the parser accepts the text”, not “the payload is correct”.
Why is a valid JavaScript object rejected?
JavaScript object literals are more permissive than JSON. They allow single quotes, unquoted keys, trailing commas, comments and functions. JSON allows none of those, so a snippet copied out of a .js file often fails here even though it runs in Node or the browser.
How accurate is the reported line and column?
The position comes from your browser's JSON parser, which is accurate about where parsing stopped. The message wording differs between engines, and parsers only report the first problem they encounter. Use the location to find the problem area, then read the surrounding lines yourself.
Why does a message sometimes come with no line number?
Some V8 messages only echo the document back, for example Unexpected token ']', "[1,2,]" is not valid JSON. That is not a display problem — the engine genuinely reported no position. When that happens this page runs its own strict scan of the document and shows the first offset where parsing cannot continue, labelled approximate so you know where the number came from.
What do the structure numbers mean?
“Values parsed” counts every node in the document, including primitives. “Object keys” counts members across all objects, “array items” counts entries across all arrays, and “nesting depth” is the deepest level reached, where the root counts as level 1.
Does it accept NDJSON or JSON Lines?
No. A JSON document must contain exactly one top-level value, so newline-delimited JSON with several objects will fail with an error about extra content. Validate one line at a time, or wrap the lines into an array first.
Is the document uploaded anywhere?
No. Validation happens in this browser tab. Nothing is sent to a server, and the input is not stored in a cookie, localStorage or analytics event.
All guides
Browse all 15 tools