DEVELOPER / BROWSER TOOL

JSON Formatter

Make JSON readable with two-space indentation.

Input JSON

Formatted Output

How to use the json formatter

Turn minified API responses and config files into readable, indented JSON.

  1. Paste your JSON into the “Input JSON” box.
  2. Press “Format JSON”. The indented version appears under “Formatted Output”.
  3. Check “Statistics” for the input and output length in characters and the number of lines.
  4. Press “Copy”, or “Download” to save formatted.json. “Clear” empties both boxes.

Good to know

  • Output uses two-space indentation.
  • Invalid JSON shows an error instead of output.
  • Your data is formatted in your browser and isn’t sent anywhere, so it’s safe for private data.

Examples

  • {"name":"Ana","tags":["a","b"]} (31 characters) becomes 7 lines, with "name" and "tags" indented two spaces and each tag four.
  • Numbers are rewritten as JavaScript reads them: 1.50 becomes 1.5, and 12345678901234567890 becomes 12345678901234567000. Keep long IDs in quotes so they stay exact.

If something goes wrong

“Invalid JSON: Expected property name or '}' …”

Usually single quotes or a key without quotes, as in {'a':1}. JSON needs double quotes: {"a":1}. In Chrome and Edge the message ends with the line and column of the problem.

“Invalid JSON: Unexpected non-whitespace character after JSON …”

There’s extra text after the data, such as a comment or a second object. Remove it, or put several objects inside [ ] separated by commas.

A key disappeared after formatting.

The same key appeared twice in one object. Only the last value is kept: {"a":1,"a":2} formats to a single "a": 2.

Questions

Does it accept comments or trailing commas?

No. It follows standard JSON, which allows neither.

Can I make JSON compact again?

Not on this page. The JSON minifier removes the extra spaces and line breaks.

Next steps: JSON validator · JSON minifier

Keep going