ToolFlow
Home›Text Tools›JSON Formatter

JSON Formatter

Use our free JSON Formatter tool to format and validate json instantly. It runs in your browser — no installation, no registration, no hidden fees.

Frequently asked questions

Is my text saved?+
No. Processing happens in your browser. Nothing is logged.
Character limits?+
Most tools support up to 100,000 characters.

The JSON Formatter takes JSON that is squashed onto one line, or badly laid out, and turns it into a clean, indented structure that is easy to read. It also works the other way: it can minify formatted JSON into one compact line. Because it has to read the JSON to do either, it also tells you straight away whether the JSON is valid.

It runs entirely in your browser, so API responses, configuration files and other data you paste stay on your device.

How to format or minify JSON

  1. Paste your JSON into the top box
  2. Click Format to indent it with two spaces per level, or Minify to remove all unnecessary whitespace
  3. Check the status line. Green means the JSON is valid. Red shows the error message from the parser
  4. Copy the result from the output box

Fixing invalid JSON

  • The tool follows the strict JSON standard, so the following all cause an error: comments, trailing commas, single quotes around strings, and keys that are not wrapped in double quotes.
  • The error message comes from your browser’s JSON parser and usually points to the position of the problem. Fix that spot and click Format again.
  • Values such as undefined, or JavaScript object syntax copied from code, are not valid JSON.

Good to know

  • Formatting does not change the data. Only whitespace is added or removed.
  • Very large whole numbers, beyond about 15 digits, can lose precision because they are read as JavaScript numbers. Keep such values as strings.
  • If an object repeats a key, only the last value survives. Keys that look like whole numbers can be reordered to the front.

When to format and when to minify

  • Format when you are reading, debugging, reviewing or documenting data.
  • Minify when you want the smallest size for sending data over a network or storing it in a config field.
Just checking validity? The JSON Validator is built for exactly that. The Formatter also reports errors, so either tool works.

Related tools

Frequently asked questions

Is my JSON uploaded anywhere?
No. It is parsed and formatted in your browser and is never sent to a server.
Why does it say my JSON is invalid when it works in my code?
Code often accepts relaxed syntax such as comments, single quotes or trailing commas. JSON itself does not, and this tool checks against the strict standard.
How many spaces does Format use?
Two spaces for each level of nesting.
Does minifying change my data?
No. It removes only spaces and line breaks that are not inside strings.
Can it handle large files?
Yes, within your device’s memory. Files of a few megabytes format quickly on most computers.

Related tools

Why ToolFlow?

100% free, no hidden costs
No account or login required
Works on any device
Fast results in seconds