Paste JSON to format it, validate syntax, minify, or sort keys. Works instantly in your browser.
Paste your JSON into the input box and click Format. The formatter uses the browser's built-in JSON parser to validate the syntax, then outputs it with consistent indentation. Any errors — trailing commas, single quotes, missing brackets — are flagged with the exact line number.
This tool formats (pretty-prints) JSON, validates syntax, minifies (compresses), and optionally sorts keys alphabetically. Everything runs in your browser — your data is never sent to a server.
Formatting adds indentation and line breaks to make JSON human-readable. Minifying removes all whitespace to reduce file size — useful when transmitting JSON over a network where every byte counts. Use the indent selector to control how many spaces are used for indentation.
Invalid JSON causes parsing errors in code. Common mistakes include trailing commas (not allowed in JSON), single quotes instead of double quotes, unquoted keys, and comments. This validator uses the browser's built-in JSON parser — if it passes here, it's valid JSON per the spec.
Sorting object keys alphabetically makes JSON easier to scan and compare. It's useful for diffing config files or API responses where key order varies between versions. Note: JSON objects are technically unordered, but sorted output is more consistent for human review.