Skip to content
ToolsEspañol

Developer

JSON formatter and validator online

Format, validate and minify JSON in your browser. Spot syntax errors instantly, with no sign-up and without sending your data to any server.

A composing stick with 7 pieces, one for each part of a JSON document. Minified, the pieces sit end to end on a single line in front of the tray; formatted, each takes its own line and shifts right according to its level. Enter, Space or the arrow keys move from one step to the next.

012
Pieces: from the single line to their own line and indentTray with indent guides every 2 spacesThe same JSON, {"a":1,"b":[2,3]}, in two ways. Minified it takes one line of 17 characters. Formatted it takes 7 lines: each brace or bracket opens a level, and each level is indented 2 spaces. The content does not change, only the whitespace.

How to use it

  1. Paste your JSON into the input box.
  2. Click “Format” to indent it or “Minify” to put it on a single line.
  3. If there is a syntax error, fix it using the hint shown; otherwise, copy the result.

Frequently asked questions

How do I know if my JSON is valid?

The syntax is checked when you format or minify it. If it is valid you will see the result; if not, a message with the reason and the position of the error.

What is the difference between formatting and minifying?

Formatting adds line breaks and a two-space indent so it is easy to read. Minifying removes every unnecessary space so it takes up as little room as possible.

Is it safe to paste private data here?

The JSON is processed in your browser and is not sent to or stored on any server. Even so, avoid pasting passwords or keys into any web page.

What JSON is and why format it

JSON is the text format most APIs, configuration files and web applications use to exchange data. Machines send it minified, on a single line with no spaces, because it takes up less room; for a person it is unreadable. Formatting lays it out with line breaks and indentation, so you can see at a glance what sits inside what.

Minifying is the opposite: removing every space and line break that is not needed. It is useful for pasting JSON into an environment variable, a request or anywhere size or line breaks get in the way.

The most common syntax errors

JSON looks like a JavaScript object, but it is stricter, and almost every error comes from that difference. Keys and strings always go in double quotes: single quotes are not allowed. A comma after the last item of a list or an object is not accepted. There are no comments. And the only unquoted values are numbers, true, false and null, in lowercase.

Another frequent slip is copying JSON from a document or a chat that has replaced straight quotes with curly ones. When the validator finds an error it states the reason and the position, which is usually right at the offending character or just before it.

Other tools