JSON Formatter
Format, validate and minify JSON in your browser.
About JSON Formatter
JSON Formatter makes JSON easy to read, checks that it is valid and can also shrink it. Paste JSON from an API response, a log or a configuration file and press Format to see it with clean indentation.
If something is wrong, the tool points to where the error is, so you can fix a missing bracket or a stray comma quickly. You can choose 2 spaces, 4 spaces or tabs, sort the keys alphabetically, copy the result or download it.
Minify does the opposite of Format: it removes spaces and line breaks so the JSON is as small as possible for sending or storing.
Who it is for
- Developers debugging API responses.
- Students learning how JSON is structured.
- Testers and analysts reading exported data.
- Anyone editing a configuration file.
How to use it
- Paste your JSON into Input.
- Choose indentation.
- Press Format to beautify, Minify to remove whitespace, or Sort keys to format with keys in alphabetical order (nested objects too).
- Copy or download the result.
Supported files and limits
- Input: JSON text.
- Output: formatted or minified JSON.
- Errors show the position of the first problem.
Privacy and processing
Your JSON is processed in your browser and not uploaded.
Examples
- {"name":"Asha","skills":["pdf","image"]} on one line becomes a readable, indented structure with Format.
- A pretty-printed file becomes one compact line with Minify before you paste it into a request.
- Press Sort keys to put object keys in alphabetical order, including nested objects, which makes two versions easier to compare.
Troubleshooting
- Error: unexpected token.
- Look at the position in the message. Common causes are a trailing comma, single quotes instead of double quotes, a missing quote around a key or an unclosed bracket.
- Comments cause an error.
- Standard JSON does not allow comments. Remove // and /* */ comments before formatting.
- Very large JSON is slow.
- Large files depend on your device memory. Try a smaller part, or use a desktop browser for very big files.
- Numbers look different.
- JSON parsers use floating-point numbers. Very long integers can lose precision. Keep such values as strings.
Frequently asked questions
Does it validate JSON?
Yes. If the JSON is invalid you see an error message with its position.
What does Minify do?
It removes spaces and line breaks so the JSON becomes smaller, without changing the data.
Is my JSON uploaded?
No. Formatting happens in your browser, so private API responses and configuration stay on your device.
Does Sort keys change my data?
It reorders keys inside objects. The values are the same, and arrays keep their order.
Can it fix invalid JSON automatically?
No. It shows where the problem is, and you fix it, so nothing is changed without you knowing.
Related tools
- Word Counter: count text.
- HTML to ZIP: zip data files.
- Password Generator: generate secrets.
- QR Code Generator: QR from text.