JSON validator and editor

Runs locally

Validate, format and explore JSON with a live tree view, duplicate-key detection and search.

Input

178 B · 8 lines

Valid JSON

Output

11 nodes · depth 3 · 8 unique keys

{
"id": 42,
"name": "Ada Lovelace",
"active": true,
"roles": [
"admin",
"editor"
],
"address": {
"city": "London",
"zip": null
},
"signedUpAt": "2024-01-15T09:30:00Z"
}
Objects2
Arrays1
Strings5
Numbers1
Booleans1
Nulls1

Search

Search across keys and values in the parsed document above.

Guide

The eight things that actually break JSON

Most JSON errors come from writing it the way JavaScript would accept it. JSON is a much smaller language than JavaScript object syntax, and the differences are exactly where people get caught. Below are the ones that account for nearly every parse failure in practice, and three that are worse — they parse cleanly and corrupt your data. Once the document is valid, the JSON formatter re-indents, minifies or sorts it, and JSONPath pulls out a single field.

Looks fine, is not JSON

{
  'name': 'shop-api',   // the service
  "replicas": 3,
  "ratio": .5,
  "limit": Infinity,
  "tags": ["a", "b",],
}

Five separate errors

Line 2  single-quoted key and value
Line 2  comments are not allowed
Line 4  .5 must be written 0.5
Line 5  Infinity is not a JSON value
Line 6  trailing comma in the array
Line 7  trailing comma in the object

Where people get caught

Trailing commas

Legal in modern JavaScript, illegal in JSON. This is the single most common cause of "Unexpected token }" and it is why a hand-edited config breaks after you delete the last entry.

Single quotes and unquoted keys

JSON has exactly one string form: double quotes. {name: 'x'} is a JavaScript object literal, not JSON — which is why copying an object out of your editor and pasting it into a JSON field so often fails.

NaN, Infinity and undefined

None of them exist in JSON. A serialiser that emits them (some Python and older Java stacks do) produces output that most other parsers reject. JSON.stringify turns them into null, which is its own surprise.

Comments

Not part of JSON at any version. JSONC and JSON5 are separate formats that some tools accept; a strict parser will not. Strip them before sending.

Duplicate keys parse fine and lose data

The spec does not forbid them, and nearly every parser keeps the last one. {"id": 1, "id": 2} validates and quietly becomes 2 — a data bug wearing a green tick, not a syntax error.

Large integers lose precision silently

JSON numbers have no size limit; JavaScript numbers do. An ID like 9007199254740993 parses without error and comes back as 9007199254740992. Send anything above 2^53 as a string.

A byte-order mark at the start of the file

An invisible BOM makes JSON.parse throw "Unexpected token" pointing at position 0, which is baffling until you hexdump the file. Files written by Windows tools and some spreadsheet exports carry one.

Literal control characters inside strings

A real newline or tab inside a quoted string is invalid — it has to be escaped as \\n or \\t. Pasting a multi-line snippet into a JSON string field is the usual cause.

About the JSON validator

How it works in 4 steps · 4 common use cases · 4 questions answered

How it works

  1. 1.Paste or upload a JSON document. It is parsed as you type.
  2. 2.If it is invalid, the exact line and column where parsing stopped is reported instead of a bare error.
  3. 3.Switch between the formatted code view and the collapsible tree, sort keys, or change the indent width.
  4. 4.Search by key or value, then copy or download the formatted result.

Common use cases

  • •Finding the missing comma in a config file the application refuses to start with
  • •Checking a hand-edited payload before pasting it into a request
  • •Exploring an unfamiliar API response as a tree rather than scrolling raw text
  • •Catching a duplicate key that JSON.parse would silently swallow

FAQ

Why does duplicate-key detection matter?

JSON.parse keeps only the last occurrence of a repeated key and reports no error, so a config with the same key twice loads cleanly and behaves in a way that does not match what you read. This tool flags the duplicate instead.

Does it accept comments or trailing commas?

No. It validates strict JSON as specified, so JSON5 and JSONC features are reported as syntax errors. That is deliberate — if your parser will reject them, this should too.

Is my JSON uploaded when I use the upload button?

No. The file is read by the browser with the File API and never leaves your machine — the same as pasting it.

How is this different from the JSON / XML page?

That page also handles XML and offers path-based search. This one is JSON-only and adds the tree view and duplicate-key detection.