JSON Formatter
Format it, shrink it, or find out exactly where it breaks. Parsed by your own browser.
Processed in your browser. No signup.
What this tool does
JSON Formatter does three things: it indents JSON so you can read it, strips every optional space so you can send it, and tells you where invalid JSON goes wrong. Parsing uses your browser's own JSON.parse, so the verdict matches what your code will do.
How to use it
- Paste JSON on the left.
- Press Format, Minify or Validate.
- If it is invalid, the message names the line and column where parsing stopped.
- Copy the result.
The actions
Format
Re-indents with 2 spaces, 4 spaces or tabs. Object key order is preserved unless you ask for it to be sorted.
Minify
Removes every space and line break that JSON does not require. The result is the same document, just smaller.
Validate
Reports whether the document parses, and describes what it is: an object with so many keys, an array with so many items, and how deeply it nests.
Sort object keys
Off by default, because it changes the document. Keys are sorted alphabetically at every level; array order is never touched. It is useful when you want to compare two JSON documents that were written in different orders — sort both, then send them toText Compare.
When JSON will not parse
The four causes behind most failures:
- Single quotes instead of double quotes. JSON only allows double quotes.
- A trailing comma before a closing brace or bracket. JSON does not allow one.
- An unquoted property name. Keys must be quoted strings.
- A bracket or brace that is never closed, which shows up as the document ending early.
Comments are not valid JSON either, even though many configuration files that call themselves JSON contain them.
Valid is not the same as correct
A document that parses is well-formed JSON. That says nothing about whether it has the fields your API expects, or the right types in them. This tool checks syntax, not schema.
Large documents
Documents up to about 2 MB are handled comfortably. Above that, formatting a deeply nested document can make the tab unresponsive for a moment, so the tool warns you first and lets you decide. Nothing is ever truncated.
Privacy
Your JSON is parsed in your browser and never sent anywhere. That matters for this tool in particular: API payloads routinely contain keys, tokens and personal data, and many online formatters post them to a server.