JSON Formatter & Validator
Paste JSON below to instantly beautify, minify or validate it. Everything is parsed locally in your browser — your data is never uploaded.
Waiting for input…
What this JSON formatter does
JSON is easy for machines to read and hard for humans to read once it has been minified into a single line. This tool re-indents it, highlights where a syntax error is, and can strip whitespace again when you need the compact version.
- Format — pretty-print with 2 spaces, 4 spaces or tab indentation.
- Minify — remove every unnecessary byte of whitespace.
- Sort keys — recursively order object keys alphabetically, which makes two JSON documents much easier to diff.
- Escape / Unescape — turn JSON into a quoted string that can be embedded in source code, and back again.
- Validate — get the character offset, line and column of the first syntax error.
Common JSON syntax errors
| Error | Cause |
|---|---|
Unexpected token } | A trailing comma after the last property. JSON does not allow them. |
Unexpected token ' | Single quotes. JSON strings must use double quotes. |
Unexpected token N | A bare NaN or Infinity value, which JSON has no representation for. |
| Unexpected end of JSON input | A missing closing brace or bracket, often from a truncated response. |
Unexpected token / | Comments. Standard JSON has no comment syntax (JSONC and JSON5 do). |
Frequently asked questions
Is my JSON uploaded to a server?
No. The page contains a small script that calls the browser’s built-in JSON.parse and JSON.stringify. Nothing is transmitted anywhere, so you can safely format configuration files or API responses that contain secrets.
What is the maximum size I can format?
The limit is your browser’s memory, not ours. Documents of a few megabytes format almost instantly; files above roughly 50 MB may make the tab unresponsive for a moment.
Why does sorting keys matter?
Object key order is not meaningful in JSON, but text diff tools compare line by line. Sorting both documents first removes noise and leaves only the real differences.
Does it support JSON with comments?
Standard JSON does not allow comments, so // like this will be reported as a syntax error. Remove comments first, or use a JSONC-aware parser.
What is the difference between formatting and minifying?
Formatting adds indentation and newlines for humans. Minifying removes them to make the payload smaller for transmission. Both produce exactly the same data.