Format, validate, and minify JSON directly in your browser.
Loading tool
About JSON Formatter
Paste JSON to validate it and pretty-print it with 2 spaces, 4 spaces or tabs, or switch to a minified single line. Invalid JSON shows the parser's error message. The output shows the root type and the size in bytes and characters, and you can copy or download it as a .json file.
Common uses
- Make a minified API response readable
- Check whether a JSON payload or config file is valid
- Normalize indentation before committing a JSON file
- Minify JSON for a request body or environment variable
FAQ
- Why is my JSON invalid?
- Common causes are trailing commas, single-quoted strings, unquoted keys, comments and values like undefined or NaN. Strict JSON allows none of these.
- Does formatting change my data?
- Only whitespace is changed. Note that the JSON is parsed and re-serialized, so duplicate keys keep only the last value and numbers beyond JavaScript's precision may be rounded.
- Is it safe to paste JSON that contains tokens or personal data?
- Formatting happens in your browser and the JSON is not uploaded to a server.