Skip to content

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 browseryour files never leave your device.

Learn more
⌘⇧F format · ⌘M minify · ⌘T tree

About 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

  1. 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.

  2. 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.

  3. 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.

  4. 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.

Frequently asked questions

Does this tool support trailing commas or comments (JSON5)?
No. The parser is strict JSON per RFC 8259 — same rules JSON.parse enforces. If you need JSON5 (comments, trailing commas, unquoted keys) you are looking at a config format like JSONC for VS Code settings, not standard JSON. Most APIs reject JSON5 outright. If you have a JSONC file with comments and you need standard JSON, strip the comments first — VS Code's "JSON with Comments" save-as does this, or a quick sed pattern handles single-line // comments.
Why does my JSON look valid but fail to parse?
Common culprits: a smart-quoted string from a word processor (curly quotes instead of straight ASCII double quotes), an unescaped backslash inside a Windows path ("C:\Users\name" must be "C:\\Users\\name" in JSON), a numeric value with a leading zero (JSON only allows leading zeros for 0 itself — "00.5" is invalid), a trailing comma after the last array element, or an Infinity or NaN that came from a JavaScript stringify but JSON does not allow either. The position pointer in the error message usually lands within a character or two of the problem.
What is the largest payload this can handle?
Several megabytes works comfortably — a typical API response with thousands of records parses and pretty-prints in milliseconds. At 10 MB things slow to a noticeable pause for parsing and pretty-printing. Above 50 MB you should pipe the file through jq or a streaming parser instead — the browser will run out of memory on the indentation step long before it runs out on the parsing step, because pretty-printing allocates a full second copy of the structure. For really large data, JSONL (one JSON object per line) is a better format.
Does the formatter preserve key order?
Yes. JSON.parse preserves insertion order on objects (this is guaranteed by ES2015 for string keys that are not numeric indices) and JSON.stringify writes them back in that order. If your input has keys in alphabetical order, the output will too. If you specifically want sorted keys for diff stability, a separate post-processing step would be needed; this tool does not reorder.
Privacy when pasting API responses with tokens?
Everything runs in your browser. JSON.parse is a native function — the input is not transmitted, no analytics, no logging. You can verify in DevTools that there is no fetch on paste. Important for production debugging where the response body might contain an auth token in an Authorization-echoed field, or PII in a user object. The local-only design is the reason this matters.
Why does a very large number lose precision?
JavaScript numbers are 64-bit floats and integers above 2^53 (Number.MAX_SAFE_INTEGER = 9,007,199,254,740,991) lose precision when parsed. Twitter snowflake IDs, Discord user IDs, and Stripe object IDs all fall in this range. The fix on the API side is to send those as strings; if your input has them as numbers you will see the rounding here when the value comes back stringified. JSON itself permits arbitrary-precision numbers — the limit is in the JavaScript number type, not in the JSON spec.
Can I sort or transform JSON with this tool?
No — the tool only formats, validates, and minifies. For sorting, jq -S sorts keys recursively. For transformation (renaming keys, filtering fields, computing aggregates) jq is the right tool. This tool focuses on the read-and-write part, which is the 90% case for daily debugging.
Why is my minified output the same size as before?
If your input was already minified — no whitespace between tokens — the minify mode has nothing to remove and the output looks identical. If your input has internal padding like spaces inside strings ("foo bar"), those are preserved because they are part of the string value, not formatting. Minification only removes whitespace between syntactic tokens.
Offline?
Yes. JSON.parse runs locally; no network required after page load. Same caveat as other tools — you need the page cached or already loaded, and after that everything works without an internet connection.