What is the JSON Formatter tool?
A JSON formatter is a tool that makes JSON data readable with line breaks and indentation, and checks that it is valid. Paste JSON to beautify it with clean indentation, validate it, or minify it for production. If the JSON is invalid, you get a clear error message with the exact line and column, so you can fix it fast. Your data is processed locally and never sent anywhere.
How to use the JSON Formatter tool
- Paste your JSON into the input box, or click Sample.
- Click Format to beautify, or Minify to compress.
- Fix any errors using the line and column shown.
- Copy or download the result.
We tested it
Tested on the live site on , with sample files we made for the test.
We pasted JSON with a stray comma at the end of an object. The tool pointed to the exact place and said what to do: "Invalid JSON: Expected double-quoted property name in JSON at position 31 (line 1, column 32). Remove the trailing comma before this bracket." With the comma removed, it reported "Valid JSON". Your JSON stays in your browser: 0 bytes were sent.
Features
- Beautify with 2 spaces, 4 spaces or tabs
- Minify JSON to a single line
- Validation with line and column of the error
- Optional alphabetical key sorting
- Copy and download as .json
What are the most common JSON errors?
The most common mistakes are trailing commas after the last item, single quotes instead of double quotes, unquoted keys, and comments, none of which are allowed in standard JSON.
| Problem | Invalid | Valid |
|---|---|---|
| Trailing comma | {"a": 1,} | {"a": 1} |
| Single quotes | {'a': 1} | {"a": 1} |
| Key without quotes | {a: 1} | {"a": 1} |
| Comment | {"a": 1 // note} | {"a": 1} |
Frequently asked questions
Is my JSON sent to a server?
No. Formatting and validation run in your browser, so API keys and private data stay on your machine.
What is the difference between format and minify?
Format adds line breaks and indentation to make JSON readable. Minify removes all unnecessary whitespace to make the file as small as possible.
Why does my JSON show an error?
Check the line and column in the message. Trailing commas, single quotes and missing quotes around keys are the usual causes.
Can it handle large files?
Yes. Files of several megabytes format in well under a second on most devices.