JSON Formatter & Validator | Minify, Beautify, and Detect Syntax Errors
Format JSON with 2/4-space or tab indentation, or minify it, and see syntax errors with the exact line and column where they occur. Everything runs in your browser only — your JSON is never sent anywhere.
All input is processed in your browser only and is never sent anywhere.
Result
Enter JSON to see the formatted or validated result instantly.
Syntax error
How to use
- Paste your JSON into the input box.
- Choose "Format" or "Minify". For Format, you can also choose the indent size (2 spaces, 4 spaces, or tab).
- The result appears instantly. If there's a syntax error, its message and location (line and column) are shown. Use "Copy result" to copy it to your clipboard.
How it works
How it works
This tool uses the browser's built-in JSON.parse / JSON.stringify — there is no custom JSON parser. As a result, input that doesn't strictly follow the JSON spec (RFC 8259) — trailing commas, single-quoted keys, comments, etc. — is treated as an error, exactly as any standard JavaScript engine would treat it.
Format
JSON.stringify(value, null, indent) converts the value into a readable, indented form. You can choose 2 spaces, 4 spaces, or a tab as the indent.
Minify
JSON.stringify(value) removes all unnecessary whitespace and line breaks to produce the smallest possible representation.
How syntax errors are shown
When a syntax error occurs, the tool shows the error message exactly as reported by your browser's JavaScript engine. If the message includes a character position, the tool scans the input independently to compute the line and column number and shows them alongside the message. If no position is included in the message, only the message is shown.
Input size limit
Input longer than 5,000,000 characters is rejected. Below that limit, the tool can handle fairly large JSON documents, subject to your browser's performance.
About Unicode characters
\uXXXX Unicode escapes are parsed correctly, and the formatted/minified output shows the actual character (e.g. \u3042 becomes 「あ」).
FAQ
Is my JSON sent anywhere?
No. Formatting, minifying, and validation all happen entirely in your browser. Nothing is sent to any server.
Why does a trailing comma cause an error?
The JSON specification (RFC 8259) does not allow a comma after the last element of an object or array. While some JavaScript object literals tolerate this, it is invalid JSON. Since this tool uses the browser's native JSON parser, it flags this the same way any standards-compliant engine would.
Can I format JSON that contains comments or single-quoted keys?
No. The JSON spec does not allow comments, and keys and strings must be wrapped in double quotes. Such input is treated as a syntax error. Extended formats like JSON5 or JSONC are not supported.
Why does the error message wording differ between browsers?
The exact wording comes directly from your browser's JavaScript engine (V8, SpiderMonkey, JavaScriptCore, etc.). The phrasing differs by engine, but what counts as invalid is determined by the same JSON specification in every case.
Can I format very large JSON files?
Yes, up to 5,000,000 characters. Beyond that limit the input is rejected. For very large JSON, rendering may be slower depending on your browser's performance.
Related tools
- Cron Expression Generator | GUI Builder & Next Run TimeBuild a cron expression from five fields or by editing it directly, validate the syntax instantly, and see the next 5 run times. Runs entirely in your browser — nothing is sent to a server.
- Hash Generator — MD5, SHA-1, SHA-256, SHA-384, SHA-512Compute MD5, SHA-1, SHA-256, SHA-384, and SHA-512 hashes from text or a file, all at once. Useful for verifying file integrity or checksums. Everything runs in your browser — your text and files are never sent anywhere.
- Password Generator — Custom Rules & Strength MeterGenerate secure random passwords with a chosen length and character types (uppercase/lowercase/digits/symbols), 1 to 20 at once, with an entropy (bit) score and strength label. Everything runs in your browser using crypto.getRandomValues() — nothing is ever sent anywhere.
- Regex Tester | JavaScript Pattern Matching & Capture GroupsTest JavaScript regular expressions instantly, see highlighted matches, and inspect numbered and named capture groups. Everything runs in your browser only — your pattern and text are never sent anywhere.
- All tools