clevr.tools
Toggle menu
Text & Code

JSON Formatter

Format, validate, and minify JSON. Instant error detection with line numbers.

Navigation

Private by default

Files stay in your browser. Nothing is uploaded unless a tool says otherwise.

Input

Indent:

Output

☕ This tool is free forever. If it saved you time, buy me a coffee.

When to use this

You just hit an API endpoint and the response came back as a single wall of text — thousands of characters with no whitespace. You need to find one nested field three levels deep, but scrolling through minified JSON is like reading a novel with no paragraphs. Paste it here and the structure appears instantly with proper indentation.

Same story when you're debugging a webhook payload, inspecting a JWT body (decode the middle segment with Base64 first, then format the JSON here), or trying to make sense of a massive config file someone committed without formatting. If the JSON is broken, you'll get the exact line and character position of the error instead of a cryptic "Unexpected token" from your browser console.

The minify direction is just as useful. You need to shove JSON into an environment variable, a URL parameter, or a single-line config field — compacting it down removes all whitespace while keeping the data intact.

Good to know

JSON is not JavaScript. Despite the name, JSON is a strict subset. Trailing commas are illegal. Keys must be double-quoted strings. No comments allowed. Single quotes don't work. If you're used to writing JS objects, these are the rules that trip you up — and this validator catches all of them.

Indentation is a style choice, not a spec requirement. The JSON specification (RFC 8259) says nothing about whitespace formatting. Two spaces, four spaces, tabs — all produce identical data. This tool defaults to 2-space indentation because it's the most common convention in web development, but the minified output is what actually gets sent over the wire.

Large JSON files can crash browser dev tools. Chrome's console pretty-printer chokes on responses above ~5MB. Pasting into a dedicated formatter is often faster and more reliable for big payloads since it doesn't carry the overhead of the entire DevTools environment.

Power user tip: JSON5 isn't JSON. If you're getting validation errors on a file that "looks right," check whether it uses JSON5 extensions (comments, trailing commas, unquoted keys). Many config tools — including VS Code's settings.json — actually use JSON5 or JSONC under the hood, which won't validate as strict JSON per RFC 8259.

Quick Reference

Common JSON ErrorWhat It MeansFix
Unexpected token at position NInvalid character at byte NCheck for trailing commas or missing quotes near that position
Unterminated stringA string value was never closedLook for a missing closing double quote
Expected ':' after keyObject key without a valueAdd a colon and value after the key
Unexpected end of inputJSON is incompleteCheck for missing closing } or ]
Duplicate keySame key appears twice in one objectRFC 8259 says keys SHOULD be unique — rename or remove the duplicate