JSON Formatter
Prettify, minify and validate JSON as you type. Catch syntax errors with the exact line and column, sort keys for clean diffs, and keep everything in your browser.
Why format JSON?
Minified JSON from an API is one long line — fine for machines, painful for humans. Formatting re-indents it into a readable tree so you can scan the structure, spot the field you need, and confirm it's valid. Going the other way, minifying strips every needless byte before you ship a payload or embed it in a config.
How to use it
- Pick a mode. Format pretty-prints with your chosen indent; Minify collapses everything to one compact line.
- Paste your JSON. It's validated and converted live, so a syntax error shows up immediately with its line and column.
- Tune the output. Choose 2 spaces, 4 spaces or tabs, turn on Sort keys for a stable order, then copy the result.
Reading the error
When JSON is invalid, the parser stops at the first problem and reports a line and column. The usual culprits are a trailing comma after the last item, a missing or smart quote around a key, or an unclosed bracket or brace. Fix that spot and the rest often falls into place.
Frequently asked questions
What does a JSON formatter do?
It re-indents JSON so it's easy to read (prettify), or strips all whitespace so it's as small as possible (minify). Along the way it validates the JSON, so you immediately see whether it's well-formed.
How do I find the syntax error?
Paste your JSON and the tool reports the first parse error with the exact line and column, so you can jump straight to the stray comma, missing quote or trailing bracket.
What does 'sort keys' do?
It recursively reorders every object's keys alphabetically. That makes two JSON documents easy to compare and produces a stable, diff-friendly output. Array order is never changed.
Is my JSON sent anywhere?
No. Parsing, formatting and validation all run in your browser with JavaScript. Nothing you paste is uploaded, logged or stored.
Does it support comments or trailing commas?
No. This tool follows the strict JSON standard, which doesn't allow comments or trailing commas. If your input has them (sometimes called JSON5 or JSONC), remove them first.