JSON Formatter
Format, validate, and beautify JSON data with syntax highlighting.
Paste JSON to format it with clean indentation and check that it's valid. Choose 2 spaces, 4 spaces or tabs, and optionally sort keys alphabetically at every level, which makes two JSON documents easy to compare. If the JSON is invalid, the error tells you what's wrong and where. You can copy the result or download it as a file. Formatting runs in your browser, so API responses, configs and other data stay on your device.
Common use cases
- Make a minified API response readable
- Find the error in invalid JSON
- Sort keys so two JSON files can be compared
- Tidy JSON config files before committing them
How to use
- Paste your JSON into the input box.
- Choose the indentation and whether to sort keys.
- Read the formatted JSON, or the error message if it's invalid.
- Copy or download the result.
FAQ
Why is my JSON invalid?
The most common causes are trailing commas, single quotes instead of double quotes, keys without quotes, and comments, none of which standard JSON allows. The error message points to where the parser stopped.
Does formatting change my data?
No. Only whitespace changes, unless you tick Sort keys, which reorders object keys but keeps every value. Very large numbers beyond JavaScript's safe range may lose precision.
Is my JSON sent anywhere?
No. It's parsed and formatted in your browser.
Related tools
- XML FormatterFormat and indent XML documents for better readability.
- SQL FormatterFormat and beautify SQL queries with proper indentation.
- HTML FormatterBeautify HTML code with proper indentation and formatting.
- CSS MinifierMinify CSS code by removing whitespace and comments.
- JS MinifierMinify JavaScript code to reduce file size.
- HTML MinifierMinify HTML code by removing unnecessary whitespace.