JSON Formatter
Pretty-print messy JSON with consistent indentation and sorted keys.
About this tool
Paste minified, inconsistently-indented, or hand-edited JSON and get back a clean, readable version — 2-space indentation, alphabetically sorted keys, ready to drop into a config file, a bug report, or documentation.
Why format JSON?
JSON straight out of an API response, a database export, or a `console.log` is usually one long line with no whitespace — technically valid, but unreadable. Formatting adds consistent indentation and line breaks so nested objects and arrays are easy to scan, and sorting keys makes two versions of a similar object easy to diff.
How it works
The formatter parses your input as JSON, so anything that isn't valid — a trailing comma, an unquoted key, a missing bracket — is caught immediately with a clear error instead of silently producing broken output. Once it parses, keys are sorted alphabetically at every nesting level and the result is re-printed with 2-space indentation.
Common uses
Cleaning up a minified API response before reading through it, normalizing config files so version control diffs stay small, or turning a single-line JSON blob from a log file into something you can actually debug.
Frequently asked questions
Does formatting change the data?
No. Only whitespace and key order change — every value, and the structure of every object and array, stays exactly the same.
What happens if my JSON is invalid?
You'll get a specific error message instead of a formatted result — this tool won't guess at how to fix broken JSON. Use the JSON Validator if you just need to locate the syntax error.
Is my JSON uploaded anywhere?
No — formatting happens in your browser tab and nothing you paste here is sent anywhere or stored.