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”.

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.

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.

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.
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.