How to format JSON
- Paste your JSON into the left box. It's checked as you type.
- Pick the layout: 2 or 4 spaces, tabs, or minify to one line for APIs and config files.
- Copy or download the result. Tick "Sort keys A–Z" to make two JSON files easier to compare.
The most common JSON errors
- Single quotes. JSON strings and keys must use double quotes:
{"name": "Ada"}, not{'name': 'Ada'}. - Trailing commas.
[1, 2, 3,]is fine in JavaScript but not in JSON. - Unquoted keys.
{name: "Ada"}is a JavaScript object, not JSON. - Comments. JSON has no comments. Remove
//and/* */lines, or use JSON5 or YAML instead. - NaN, undefined and Infinity aren't valid values. Use
nullor a string.
Is my data private?
Yes. Formatting happens with your browser's own JSON parser. Nothing is uploaded, which matters when you're pasting API responses that contain customer data or tokens.
Questions people ask
How do I validate JSON?
Paste it in. A green bar means it's valid JSON, with the number of keys and nesting depth. A red bar gives the line and column of the first error and a hint to fix it.
What's the difference between formatting and minifying JSON?
Formatting adds line breaks and indentation so people can read it. Minifying removes all spare whitespace to make the file as small as possible for sending over a network.
Can it sort JSON keys alphabetically?
Yes. Tick Sort keys A–Z and every object, including nested ones, is sorted. Array order is kept.
Is there a size limit?
Only your device's memory. Files of several megabytes format in well under a second on a modern laptop.