Part of JSON tools
JSON formatter: validate, pretty-print, and minify JSON online
How to use this formatter
- Paste JSON from an API client, log file, or editor into the input area.
- Choose indentation (2, 4, or 8 spaces) and click Format to pretty-print.
- Click Minify when you need a single-line payload for curl, storage, or env vars.
- Copy or download the result after fixing any syntax errors the validator reports.
Valid JSON vs common syntax errors
JSON requires double-quoted keys and string values, commas between elements, and no trailing comma after the last item in an object or array.
Single quotes, unquoted keys, and comments are not valid in strict JSON—though some tools accept JSONC with comments, this formatter follows the JSON.parse rules your browser uses.
Typical failures include a missing comma between properties, an extra comma before `}`, unescaped quotes inside a string, or text that is actually JavaScript (functions, `undefined`, trailing commas).
The error message usually points near the character that broke parsing; fix one issue at a time and re-format.
Indentation, nesting, and readability
Pretty-printing reveals how objects and arrays nest—critical when debugging webhooks or GraphQL responses with deeply nested `data` nodes. Two-space indent is common in JavaScript projects; four spaces appear in many enterprise configs.
Minifying removes whitespace without changing values, which is useful before embedding JSON in a URL query (with caution) or shipping a small config blob.
Formatting does not sort keys. If you need keys alphabetized for diff-friendly commits, do that in your editor or CI—the formatter preserves the insertion order the parser returns.
Practical developer use cases
API debugging: Paste a 401 or 500 response body to spot missing fields before opening a ticket. Config review: Open `package.json`, CI YAML exports, or cloud policy JSON side by side with formatted output. Documentation: Clean up examples for README files or internal wikis.
Support: Share readable JSON with teammates who do not have Postman installed.
This page checks syntax only. Schema checks belong in a dedicated validator.
Secrets, tokens, and privacy
Never pretty-print production responses containing access tokens, session cookies, or PII into a shared screenshot without redacting. Because processing is local, pasting a staging token is safer than uploading to a random online formatter—but your clipboard and screen sharing still matter.
Large files (hundreds of kilobytes) may slow older tabs; split huge log dumps or filter in your terminal first, then format the fragment you need.
Before and after examples
Formatting changes whitespace only—the data values stay the same.
| Original | Converted | Notes |
|---|---|---|
| {"name":"Ada","active":true} | { "name": "Ada", "active": true } | Object with boolean |
| [1,2,{"k":"v"}] | [ 1, 2, { "k": "v" } ] | Mixed array |
| { "a": 1 } | {"a":1} | Minified single line |