JSON formatter, validator and minifier

JSON formatter and validator: paste your JSON – the tool checks it instantly, points to the exact error with an explanation, and gives you the result pretty-printed or minified, ready to copy. Nothing is uploaded.

Source: STD 90, §§ 2–9, IETF RFC 8259 – The JavaScript Object Notation (JSON) Data Interchange Format. Updated: .

Paste or type JSON – it is checked on every change.

Your text stays in your browser – it is not sent, not stored and not added to the address bar.

Sorts the keys of every object (nested ones too); the order inside arrays is kept.
My ToolboxYour inputs are saved in this browser only.

Result

Result
✓ Valid JSON
Statistics
Values: 15 · Objects: 4 · Arrays: 1 · Keys: 12 · Depth: 4 · Characters: 202 → 297
Output
{ "company": "Example Inc.", "founded": 2019, "active": true, "revenue": 1250000.50, "locations": [ { "city": "London", "staff": 42 }, { "city": "New York", "staff": 17 } ], "contact": { "email": "info@example.com", "phone": null } }

How it is calculated

What the tool checks

The rules come from RFC 8259, the internet standard for JSON (equivalent to ECMA-404). The tool reads your text character by character with its own parser and stops at the first violation. The message gives the line and column, marks the spot with a ^ and explains what is wrong – identical in every browser, because the built-in JSON.parse messages differ between browsers and are often unhelpful (“Unexpected token”).

How to format and validate JSON

  1. Paste your JSON into the input field – validation starts immediately.
  2. Choose the output: format (indent with 2 or 4 spaces or a tab) or minify; sort keys alphabetically if you like.
  3. If there is an error, read the line, column and explanation and fix it; otherwise copy the result.

Example: For {"name": "Anna", "age": 30,} the tool reports the trailing comma at line 1, column 27. And {"b": 1, "a": [1, 2]} becomes {"a":[1,2],"b":1} when minified with sorted keys.

The most common JSON errors

Beautify, minify, sort

The output is rebuilt from the validated content: Beautify indents each level with 2 or 4 spaces or a tab, Minify removes all optional whitespace (smallest file). Numbers and strings are kept exactly as written – unlike JSON.parse + JSON.stringify, 1.0 does not become 1 and 12345678901234567890 is not rounded. Sort orders keys by Unicode code units as in the JSON Canonicalization Scheme (RFC 8785): uppercase before lowercase, accented letters after both.

Warnings rather than errors

Duplicate keys in the same object are not forbidden by RFC 8259, but unreliable: most programs keep only the last value. A byte order mark at the start may be ignored by a parser – the tool does so and tells you.

Limits

The tool checks syntax, not meaning: whether required fields are missing or types are right is a job for a JSON Schema. Columns count Unicode characters starting at 1 (a tab = 1 character); editors with a tab width of 4 show a higher column. Input is limited to 5 million characters and 1,000 levels of nesting.

More validation tools: check XML and CSV with the XML and CSV validator, test patterns with the regex tester and decode content with the Base64 decoder.

Frequently asked questions

Is my JSON uploaded or stored?

No. Validation and formatting run entirely in your browser. The text is not added to the address bar and not saved – only the options (output, indentation, sorting) are part of the link.

Why are comments and trailing commas not allowed?

JSON is deliberately minimal so that every programming language reads it the same way. Comments and trailing commas belong to extensions such as JSON5 or JSONC (used for VS Code settings, for example) – as plain JSON those files are invalid.

My JSON is valid, but the program still rejects it – why?

Usually the content does not match what the program expects: a missing required field, a number instead of a string, or a different structure. That is described by a JSON Schema or the API documentation. Also check the warning about duplicate keys.

Does the line and column match my editor?

Lines always do. Columns count characters starting at 1; a tab counts as one character, so does an emoji. Editors that display tabs as 4 columns will show a higher number. “Jump to error” puts the cursor right on the spot.

How do I find the problem after “unexpected end”?

Almost always a closing } or ] or a quotation mark is missing. The message names the line of the bracket that is never closed – look at the end of that block first.

Sources and legal basis

As of: · Editorial policy

Related tools