JSON Formatter
Part of JSON tools
JSON formatter: validate, pretty-print, and minify JSON online
A JSON formatter takes compact or messy JSON text and either expands it with readable indentation or compresses it to a single line. Developers reach for this when an API response arrives as one unreadable string, when a config file fails to parse because of a missing comma, or when documentation needs a tidy example block.
Formatting runs in your browser after the page loads: paste a payload, format or minify, then copy or download. Invalid JSON surfaces a parse error with the line context the engine provides—your JSON is not uploaded to Case Modify servers.
How to use this converter
- 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.
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 |
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.
Pair this tool with JSON Escape when you need a string literal inside another JSON document, or CSV to JSON when the source data is tabular. For schema validation against JSON Schema, use a dedicated validator—this page checks syntax only.
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.
Frequently asked questions
Does the JSON formatter accept comments?
No. Standard JSON does not allow `//` or `/* */` comments. Remove comments or use a JSONC-aware editor before pasting here.
Will formatting change my data types?
No. Numbers stay numbers, booleans stay booleans, and strings stay strings. Only whitespace between tokens changes.
Can it repair trailing commas automatically?
No. JSON.parse rejects trailing commas. Delete the extra comma manually, then format again.
Is my JSON uploaded to a server?
No. Parse and stringify run in this browser tab after the page loads.
What is the difference between format and minify?
Format adds indentation and line breaks for humans. Minify removes optional whitespace to produce the shortest valid representation.