Skip to content

JSON Formatter & Beautifier

Paste JSON, format it with 2 or 4 spaces, minify it, or check it for errors. Runs in your browser, so the data is not uploaded.

data_object JSON Editor & Formatter
verified Valid JSON • 8 Properties • 1.4 KB Payload
Line 1, Col 1
Input JSON (Raw / Unformatted)
Formatted Output (Beautified)
•

What this tool does

Paste JSON into the left box and the tool rewrites it in the right box. Format (2 spaces) and Format (4 spaces) add line breaks and indentation so a one-line API response becomes readable. Minify does the reverse and removes every space that isn’t inside a string. Validate only reports whether the text parses.

There is also a Paste sample button if you want to see what the output looks like, and Copy and Download buttons for the result.

How to use it

  1. Paste your JSON into the left box, or press Paste sample.
  2. Press Format (2 spaces), Format (4 spaces) or Minify. Press Validate to only check it.
  3. Read the result in the right box, then Copy or Download it.

How it works

Everything is done with your browser’s own JSON.parse and JSON.stringify. Nothing is sent to the server, which matters if you are looking at a response that contains tokens or customer data.

Because it uses the browser’s parser, the error text is the browser’s error text. Chrome and Firefox word it differently, and most versions include the position of the problem. The page shows that message as it is.

One side effect of JSON.stringify: the output is rebuilt from the parsed data. Whitespace and formatting from the original are lost, duplicate keys collapse to the last one, and very large numbers can lose precision because JavaScript stores them as 64-bit floats.

What it will not accept

The input has to be strict JSON. These are common reasons it fails:

  • A comma after the last item: {"a": 1,}
  • Single quotes around strings or keys
  • Keys without quotes: {name: "x"}
  • Comments (// or /* */)
  • Values like undefined, NaN or Infinity

If you have a JavaScript object literal or a JSON5 file, fix those parts first.

When I’d use it

  • Reading an API response copied from the browser’s network tab
  • Checking a composer.json, package.json or theme.json file before committing it
  • Shrinking a JSON payload before pasting it into a config field

For checking JSON against a shape you expect, see JSON to JSON Schema. If you only need a yes or no, JSON Validator opens the same editor.

Is my JSON uploaded anywhere?

No. Formatting runs in your browser with the built-in JSON functions, so the text stays on your device.

Can I choose tabs for indentation?

No. The buttons offer 2 spaces and 4 spaces. If you need tabs, format with either option and replace the leading spaces in your editor.

Why does it say my JSON is invalid when it works in JavaScript?

JavaScript accepts things JSON does not, such as single quotes, unquoted keys, comments and trailing commas. Strict JSON allows none of them.

Does formatting change my data?

The values stay the same, but the text is rebuilt from parsed data. Duplicate keys collapse to the last value, and numbers larger than JavaScript can store exactly may be rounded.

Can I save the formatted result?

Yes. Use Copy to put it on your clipboard or Download to save it as a file.