Make unreadable JSON easy to read, find the exact line of a syntax error, and fix the mistakes that break JSON most often: trailing commas, quotes and comments.
APIs and config files often give you JSON on one long line. A formatter adds indentation so you can read it, and a validator tells you exactly where it's broken.
Format JSON in seconds
- Open the JSON Formatter.
- Paste your JSON (or click the example button to try it).
- Choose the indentation, and read, copy or download the result.
It runs in your browser, so API keys or customer data in the JSON never leave your device.
Before and after
{"name":"Ali","marks":[88,92],"passed":true}
becomes
{
"name": "Ali",
"marks": [
88,
92
],
"passed": true
}
The five most common JSON errors
| Error | Wrong | Right |
|---|---|---|
| Trailing comma | [1, 2, 3,] | [1, 2, 3] |
| Single quotes | {'a': 1} | {"a": 1} |
| Unquoted keys | {a: 1} | {"a": 1} |
| Comments | {"a": 1 // note} | Remove the comment |
| Special values | NaN, undefined | null or a number |
The validator shows the line and column of the first problem. Look just before that point: a missing comma or bracket on the previous line is a common cause.
Minify for production
Formatted JSON is for people; minified JSON is for machines. Minifying removes spaces and line breaks to make files and API responses smaller. For other code, use the CSS Minifier and JavaScript Minifier.
Need a spreadsheet?
If your JSON is a list of records, the JSON to CSV converter turns it into a table you can open in Excel or Google Sheets. For other text data, the Base64 and URL encoders and the Regex Tester are in the same Developer Tools section.