Working with minified JSON from APIs? Here's how to quickly format it for readability.
Why Prettify JSON?
API responses and config files are often minified to save bandwidth:
{"name":"John","age":30,"address":{"city":"NYC","zip":"10001"},"tags":["dev","js"]}
Prettified JSON is much easier to read and debug:
{
"name": "John",
"age": 30,
"address": {
"city": "NYC",
"zip": "10001"
},
"tags": [
"dev",
"js"
]
}
Quick Methods
Command Line
echo '{"a":1}' | python -m json.tool
echo '{"a":1}' | jq .
JavaScript
const formatted = JSON.stringify(data, null, 2);
Online Tool
Use the free JSON Prettifier for instant formatting with:
- Syntax validation
- 2-space indentation
- Copy to clipboard
- No data sent to servers
Related Tools
- JSON Formatter - Full-featured JSON formatter
- JSON Validator - Validate JSON syntax
- JSON Minifier - Minify JSON for production
- JSON to YAML - Convert JSON to YAML
Top comments (0)