About the JSON Formatter
JSON (JavaScript Object Notation) is the de facto data format for APIs, config files, and structured logs — but raw JSON from a minified API response or a log line is often a single unreadable line of text.
This tool validates your JSON and pretty-prints it with proper indentation, or minifies it down to the smallest possible representation, entirely in your browser.
How it works
- Paste your JSON into the input box.
- Click Format to pretty-print it with 2-space indentation, or Minify to strip all unnecessary whitespace.
- If the JSON is invalid, the exact parser error message appears so you can find and fix the problem.
Common use cases
- Reading API responses: Pretty-printing a minified JSON response copied from a browser's network tab so nested objects and arrays are actually readable.
- Shrinking config payloads: Minifying a formatted JSON config before embedding it in an environment variable or a single-line script argument.
- Validating hand-written JSON: Catching a missing comma or an unquoted key in a `.json` config file before it breaks your build.
Frequently asked questions
Why does Format fail with 'Unexpected token'?
This is JavaScript's native JSON parser telling you exactly where the syntax is invalid — common causes include trailing commas, single quotes instead of double quotes, or unquoted object keys, none of which are valid in standard JSON.
Does JSON support comments?
No — the JSON specification has no comment syntax. If you need comments, consider JSON5, JSONC, or YAML (see the YAML ↔ JSON Converter), which do support them.
What's the difference between Format and Minify?
Format adds indentation and line breaks for human readability; Minify removes all non-essential whitespace to produce the smallest possible payload, which is what you'd typically send over the network.
Is there a size limit?
The tool runs entirely in your browser's memory, so very large JSON files (tens of megabytes) may be slow depending on your device, but there's no artificial size cap imposed by the tool itself.
This tool runs entirely in your browser — nothing you enter is sent to a server. Read more in the Privacy Policy, or browse the full list of tools.