JSON Formatter & Validator Online
Pretty-print, validate, or minify any JSON. Errors show their position so you can find the trailing comma without grepping.
In your browser—your files never leave your device.
Learn moreAbout this tool
JSON parses by the RFC 8259 rules, which means no comments, no trailing commas, double-quoted keys only, and strict number formats. The format is unforgiving in a way that catches people out daily — a missing brace ten lines back, a single quote where a double should be, an unescaped newline inside a string. This tool runs JSON.parse on whatever you paste, so the validation is identical to what your Node, browser, or any RFC 8259 parser will do at runtime. Format mode pretty-prints with 2 or 4 spaces; minify mode strips all whitespace down to one line. Both work on payloads up to several megabytes without choking. When parsing fails the error message points at the position of the problem so you can fix it without scrolling through 1,200 lines of minified output.
How to json formatter & validator online
-
Paste your JSON
Drop it into the input box. Minified, ugly, deeply nested, freshly copied from a curl call — the parser does not care. Empty input leaves the output blank; one character of invalid JSON gives you an error.
-
Pick a mode
2 Spaces and 4 Spaces produce indented, human-readable output. Minify strips every whitespace character for the smallest possible payload. Switching modes re-runs the parser on the current input, so you can pretty-print, then minify the same data without retyping.
-
Read the result or the error
If parsing succeeds the output appears below. If it fails you get a position-aware error and a "Show technical details" toggle for the full parser message. Common errors point to the exact character, so you can scroll directly to position 1247 in your input and find the smart-quote that snuck in from a copy-paste.
-
Copy and ship it
One click copies the output to your clipboard, ready to paste into your code, a config file, Postman, a curl flag, or a Slack message where you want the JSON to render readably. The copy button uses the Clipboard API and works on mobile too.
Why use this tool
I paste API responses into this constantly. The Stripe API, the GitHub API, the Notion API — they all return JSON that is technically minified, technically valid, and completely unreadable in a terminal without a pipe through jq. This tool gives you the jq experience in a browser tab. The second case is debugging a 400 error from your own API: you have a request body that the server is rejecting, and you need to know whether the JSON is malformed or whether the schema is wrong on the application side. Paste it here, and if it parses you know the JSON is fine and the problem is elsewhere. The third use is shrinking a config blob for a one-line env var — minify a 50-line JSON config down to a single line that fits in a CI variable, or in a Docker ENV statement. The fourth is teaching: showing someone what a nested JSON structure looks like once it has whitespace is far more effective than describing it. Everything stays in your browser, so production tokens in the payload do not leak to a third-party logger.
Features
Format, minify, or validate
Toggle between 2-space, 4-space, or minified output. Validation runs automatically on whatever mode you are in — invalid JSON shows an error and a position pointer instead of silent partial output. The format modes match the conventions of npm (2 spaces) and most Python style guides (4 spaces), so output drops cleanly into the codebase you are working in.
Position-accurate error messages
When parsing fails the tool tells you the position of the failure and offers a friendly hint ("missing closing bracket", "unquoted key", "unexpected character X at position 1247"). For long minified inputs this is the difference between a minute of debugging and a quarter-hour of scrolling. There is also a Show technical details toggle that exposes the raw JSON.parse error message in case you want the engine's exact diagnostic.
Strict RFC 8259 parser
No trailing commas, no comments, no single quotes, no unquoted keys. Same rules JSON.parse enforces. This is intentional — your backend is going to use a strict parser too, and "it worked in this tool" should mean "it will work in your code". If you have JSONC (JSON with comments, used by VS Code settings) or JSON5 (with trailing commas and unquoted keys), strip the extensions first; most production servers will reject those.
Handles big payloads
Multi-megabyte JSON works. The output viewer streams the formatted text with a max-height scrollable container instead of locking up the page. There is no fixed nesting depth limit beyond what your browser engine imposes (V8 allows roughly 7,000 levels deep, which is enough for any sensible API). Format-vs-minify is just a JSON.stringify call with or without the indent argument, so performance is the same either way.
Privacy & security
Parsing runs through JSON.parse — built into every browser, no network call. Pretty-printing uses JSON.stringify with an indent argument; minification re-stringifies with no spacing. Both happen in the same JavaScript thread that holds your textarea. JSON payloads that contain secrets — API responses with tokens, .env-file content pasted as JSON, internal log dumps — stay in your tab. The error-position display that points at where parsing failed is also computed locally from the parser's error message.