What makes JSON valid?
JSON (JavaScript Object Notation) is the most common format for APIs and config files. It is strict, and most errors come from a few rules:
- Keys and strings use double quotes:
"name", not'name'. - No trailing commas after the last item in an object or array.
- No comments.
//and/* */aren't allowed. - Only
true,false,null, numbers, strings, arrays and objects.undefined,NaNand functions are not JSON.
When something is wrong, the formatter shows the line and column where reading stopped. The real mistake is usually just before that point.
Beautify or minify?
| Beautify | Minify | |
|---|---|---|
| Looks like | Indented, one value per line | Everything on one line |
| Use for | Reading, debugging, code reviews | Sending over a network, storing |
| Size | Larger | Smallest |
Sorting keys A to Z makes two JSON files easy to compare with a diff tool.
Is it safe to paste API responses?
Yes. Formatting happens in your browser and nothing is sent to a server, so tokens, customer data and config secrets stay on your machine.
Related tools
Turn a JSON array into a spreadsheet with JSON to CSV, or encode a JSON payload with the Base64 Encoder.