JSON Formatter & Validator
Paste JSON and make it readable — or small. Format pretty-prints with 2 spaces, 4 spaces, or tabs, optionally with object keys sorted; Minify strips it to one line; Validate just checks it. When the JSON is broken, you get the exact line, column, and a pointer under the problem instead of a shrug.
Parsing runs entirely in your browser. API payloads and config files — the JSON people most need to debug — never leave your machine.
Reorders keys alphabetically at every level when formatting.
Parsed and formatted entirely in your browser — your JSON never leaves this page.
Embed this calculator on your website →
The formula
format = parse â re-print with a fixed indent · validate = parse and report the first error’s line : column
- the parser is strict JSON — double-quoted keys and strings, no trailing commas, no comments, no single quotes. “Almost JSON” (JSON5, JS objects) is rejected with the position of the first problem.
- duplicate keys — if an object repeats a key, the last value wins, matching what virtually every JSON consumer does with your file.
- sort keys — reorders object keys alphabetically at every depth; arrays always keep their order, because in JSON array order is meaning.
Worked example: the one-liner {"b":1,"a":[1,2,{"x":true}]} formats into a nested document with “b” before “a” exactly as written — and with Sort keys on, “a” moves first at every level.
How it works
The tool parses your text with a strict JSON parser written for this site — not a regular expression and not a forgiving JavaScript evaluation. A successful parse is re-printed in the style you chose. A failed parse stops at the first character that cannot be right and reports its line and column, with the offending line shown and a caret under the position.
The errors people hit most: a trailing comma after the last item (valid in JavaScript, invalid in JSON), single-quoted strings, unquoted keys, and a missing comma or closing bracket several lines before the reported position — the parser reports where it noticed, which is where the structure stopped making sense.
Examples
- An API response → a 4,000-character one-line payload becomes an indented tree you can actually scan for the one field you need.
- A trailing comma → {"a": 1,} is rejected at the closing brace — remove the comma and it validates.
- Before committing a config → Validate confirms the file parses, so a broken deploy is caught at your desk instead of in production.
Frequently asked questions
Is my JSON uploaded to a server?
No. Parsing and formatting happen in your browser — open your network tab and you will see no request when you format. That privacy property is the main reason this tool exists.
Why does it reject JSON that works in my JavaScript?
JavaScript object literals are a superset: they allow single quotes, unquoted keys, trailing commas, and comments. JSON the standard allows none of those. If your text works as JS but fails here, one of those four is almost certainly the difference.
Does formatting change my data?
No — formatting changes only whitespace (or nothing at all, for minifying). Numbers, strings, key order (unless you sort), and array order survive exactly. Duplicate keys are the one exception to 'exactly': like most parsers, this one keeps the last value.
Can it handle very large files?
Yes, within your device’s memory â multi-megabyte JSON formats fine in a modern browser precisely because no upload is involved. Extremely deep nesting (thousands of levels) is the main thing that can strain it.
Related calculators
Base64 Encode / Decode
LiveEncode text to Base64 or decode Base64 back to text, with full UTF-8 support for accents and emoji.
URL Encode / Decode
LiveEncode text for safe use in URLs, or decode percent-encoded URLs back to readable text.
Unix Timestamp Converter
LiveConvert Unix timestamps in seconds or milliseconds to readable dates, and dates back to timestamps.

