Boring Tools

JSON Formatter

Open tool

Format, validate, and minify JSON instantly.

Paste JSON to check that it is valid, then either pretty-print it so it is easy to read or squash it onto one line to make it as small as possible. Useful for inspecting API responses, tidying config files, and finding the exact spot where a document is broken.

How it works

The text is parsed with the browser's built-in JSON.parse. If parsing succeeds, the result is written back out with JSON.stringify — indented by two spaces for Format, with no whitespace at all for Minify. If parsing fails, nothing is output and the parser's own error message is shown.

Because the JSON is parsed and re-written rather than just re-spaced, the output is a normalised version of your input. Numbers like 1.0 and 1e3 come out as 1 and 1000, and escape sequences are rewritten in their shortest form.

How to use it

  1. Paste or type your JSON into the Input box.
  2. Click Format to pretty-print it, or Minify to compress it to a single line.
  3. Read the result in the Output box (it sits beside the input on wide screens, below it on phones).
  4. Use Copy to put it on your clipboard or Download to save it as a file.
  5. If a red message appears instead, fix the problem it describes and click the button again.

Options & controls

Input

Input
The text to process. Nothing runs while you type — the result only updates when you click Format or Minify. Leaving the box empty and clicking either button just clears the output and any error.

Buttons

Format
Pretty-prints the JSON with two-space indentation and one item per line.
Minify
Removes every optional space and line break, producing the most compact valid JSON.
Reset
In the title row at the top of the page. Clears the input, the output, and any error message.

Output

Output box
Read-only. Appears once a Format or Minify succeeds; click into it and select text as usual.
Copy
Copies the whole output to your clipboard. The button briefly confirms that it worked.
Download
Saves the output as formatted.json (the file name is the same whether you formatted or minified).
Error message
A red banner under the buttons showing why the input is not valid JSON, in your browser's own wording. The exact text differs slightly between Chrome, Firefox, and Safari, but it normally names the offending character or position.

Tips & guidelines

  • The most common causes of an error are a trailing comma after the last item, single quotes instead of double quotes, unquoted property names, and comments — none of these are allowed in standard JSON.
  • Use Format when you want to read or diff the data, and Minify when you want to paste it into a URL, a config value, or a request body.
  • You can run Format on already-minified JSON (and the reverse) as often as you like; the data is never changed, only its layout.

Limits

  • Only strict JSON is accepted. JSON5, JSON with comments, and JavaScript object literals will be reported as errors.
  • Integers larger than 9,007,199,254,740,991 (2^53 − 1) lose precision, because they are held as ordinary JavaScript numbers. Keep such values as strings if exact digits matter.
  • If an object has duplicate keys only the last one is kept. Keys that look like whole numbers ("2", "10") are also moved to the front of their object in ascending order — that is how JavaScript orders object keys.
  • There is no option to change the indentation width or sort keys.

Saved in your browser

Nothing. The input and output live only in the open page and are gone when you refresh or close the tab.

← All documentation