How to format and check your JSON
- Paste or type your JSON into the box above.
- Look at the status badge. If something is wrong, such as a missing bracket, a key without quotes or an extra comma, the error message appears straight away.
- Press "Beautify" to indent it with 2 spaces so it's easy to read, or "Minify" to remove all spaces and line breaks and make it as small as possible.
- Press "Copy to clipboard" to copy the result.
Example
JSON from an API often arrives on one long line:
After "Beautify", each key is on its own line and nested items are indented:
Common JSON errors and how to fix them
JSON looks like JavaScript, but its rules are stricter. These are the mistakes that cause most errors:
| Problem | Wrong | Right |
|---|---|---|
| Comma after the last item | {"a": 1,} | {"a": 1} |
| Single quotes | {'a': 'x'} | {"a": "x"} |
| Key without quotes | {a: 1} | {"a": 1} |
| Comments | {"a": 1 // note} | {"a": 1} |
| Values JSON doesn't have | {"a": undefined} | {"a": null} |
JSON also has no NaN or Infinity, and text inside quotes can't contain a real line break: write \n instead.
Your data stays on your device
JSON often contains things you shouldn't share, such as API keys, customer details or internal records. This formatter checks and formats your JSON with your browser's own built-in JSON engine. Nothing you paste is sent to us or anyone else, and it's gone when you close the page.
Frequently asked questions
What causes most JSON errors?
A comma after the last item in a list or object, single quotes instead of double quotes, and a missing closing bracket or brace. The table above shows how to fix each one.
Can I format a large file?
Yes. Files of a few megabytes are usually formatted in a moment. Very large files can be slow on older phones and computers, because all the work happens on your own device.
What's the difference between JSON and a JavaScript object?
A JavaScript object can use single quotes, keys without quotes, comments and values like undefined. JSON allows none of these. If you've copied an object out of JavaScript code, you may need to fix those parts before it counts as valid JSON.
Should I beautify or minify?
Beautify when people need to read it, for example when you're checking an API response or editing a settings file. Minify when a program reads it and size matters, for example data sent over a network.