Skip to the JSON editor
JSON Formatter Viewer

JSON validator

input.json

Paste your JSON here

or drop a .json file anywhere here

Formatted output appears here.

Waiting for input

What the error panel shows you

Native parser messages are terse and vary by browser — Unexpected token } tells you almost nothing about what to change. When validation fails, four things are reported instead:

  • Line and column, derived from the character offset the parser reported.
  • The source line with a caret under the exact character, windowed so the caret stays visible even on a 4,000-character minified line.
  • What the parser expected, rewritten in plain language — “expected a comma or a closing brace after this value” rather than the raw engine string.
  • A likely cause, inferred by inspecting the source around the fault for the mistakes listed below.

The faulty line is also marked in the editor gutter, and Jump to error places your cursor on the character so you can fix it and watch the status turn valid as you type.

Every common cause, and its fix

Trailing comma

Valid in JavaScript, invalid in JSON. The parser reports “expected property name” or “expected a value”, because after a comma it requires another member.

{ "a": 1, "b": 2, }   ✗
{ "a": 1, "b": 2 }     ✓

Single quotes

JSON strings are double-quoted, for both keys and values. There is no exception.

{ 'name': 'ada' }      ✗
{ "name": "ada" }      ✓

Unquoted property names

JavaScript object literals allow bare identifiers as keys; JSON does not. This is the single most common reason a snippet copied out of source code fails to validate.

{ name: "ada" }        ✗
{ "name": "ada" }      ✓

Comments

JSON has no comment syntax — deliberately. If you need annotations in a config file, use a"_comment" key, or a format that supports them such as JSON5, YAML, or TOML. Repair strips // and /* */ comments so you can at least read the data.

Python and JavaScript literals

True, False, and None come from pasting a Pythonrepr; undefined, NaN, and Infinity come from JavaScript. JSON has exactly three keywords, all lowercase: true,false, null. There is no way to express NaN or infinity in JSON — usenull or a string sentinel.

Unescaped characters inside strings

A literal newline, tab, or unescaped double quote inside a string terminates it early, and the error usually surfaces several tokens later than the real mistake. Escape them as\n, \t, and \". Raw control characters below U+0020 are never permitted.

Multiple top-level values

A JSON document holds one value. Two objects separated by a newline is NDJSON — a different, very useful format, but you must parse it line by line. Repair recognises it and wraps the lines into an array so you can view the whole file at once.

A prefix before the JSON

A leading byte-order mark, a JSONP callback wrapper such ascallback({...}), or an anti-hijacking prefix such as)]}' will all fail at the first character. Repair removes BOMs and JSONP wrappers.

Valid but risky

Passing validation does not mean a document is safe to ship. Two things are legal JSON and still cause real problems:

  • Duplicate keys. The grammar permits them; behaviour is implementation-defined. JavaScript keeps the last occurrence, so data can silently disappear.
  • Integers beyond 253−1. Any JavaScript-based consumer loses precision on parse. If your identifiers are 64-bit, serialise them as strings.

Once the document validates, the tree viewer is the fastest way to check that the structure is what you expected, and formatting makes it reviewable.

Common questions

Which JSON specification is used?

The browser’s native parser, which implements RFC 8259 and ECMA-404. Those two are equivalent for practical purposes, and RFC 8259 supersedes RFC 7159 and RFC 4627. A document that validates here parses in Node, Python, Go, and Java.

Does this check my JSON against a JSON Schema?

No — this validates syntax, not shape. It answers “is this parseable JSON?” rather than “does this match my contract?”. Structural validation against a schema needs the schema, and is better run in your test suite than in a browser tab.

Why does the reported column differ from my editor?

Columns are counted in characters starting at 1, matching what the parser reports. Editors that display tabs as several columns will show a larger number on lines that begin with tabs. The caret in the error panel always points at the right character.

Is an empty document valid JSON?

No. RFC 8259 requires exactly one value, so an empty file is invalid. null, 0, false, "", [], and {} are all valid documents on their own.

Can a valid JSON document still break my application?

Yes. Duplicate keys are permitted by the grammar but resolved differently across parsers — JavaScript keeps the last, some libraries keep the first, others error. The status bar shows total keys against unique keys; when those numbers differ somewhere in your document, duplicates are worth a look.

The rest of the toolkit

Same engine, same privacy — every page runs entirely in your browser.