How to format JSON online
- Paste or type your JSON into the editor above.
- Click Format to pretty-print it with 2 spaces, 4 spaces or tabs, or Minify to strip all whitespace.
- Use Sort keys to order object keys alphabetically, which makes two JSON documents easy to compare.
- Copy the result or download it as a
.jsonfile.
Validation runs as you type. If the JSON is invalid, the formatter tells you the error and the exact line and column, and puts the cursor on the problem character. Common causes are trailing commas, single quotes instead of double quotes, and unquoted keys.
Is my data private?
Yes. This JSON formatter is written in plain JavaScript and runs entirely in your browser. Your JSON is never uploaded to a server, which makes it safe to use with API responses, config files and other sensitive data. Your last input is kept in your browser's local storage so it is still there when you come back.
What is the difference between formatting and minifying JSON?
Formatting (beautifying) adds line breaks and indentation so JSON is easy to read. Minifying removes all unnecessary whitespace so the file is as small as possible for sending over a network.
Why does my JSON say "Unexpected token"?
The parser found a character it did not expect. Check the reported line and column for a trailing comma, a missing quote, a single-quoted string or a comment, as none of these are allowed in standard JSON.
Can it handle large JSON files?
Yes. Files of several megabytes format instantly, because everything runs locally with your browser's native JSON parser.