Skip to content
1001 Tools
sr
Developer tools

JSON Formatter

Paste JSON and get it neatly indented, or minified to a single line — and if it isn’t valid JSON, you get the parser’s error message instead of a silent failure. It runs entirely in your browser, so API responses, tokens or config you paste never leave your device.

Result

How it works

The tool parses your text with the same JSON engine your browser and Node use, then re-serialises it. Beautify mode re-indents with two or four spaces or a tab; minify mode drops every insignificant space and newline for the smallest payload. Because it fully parses first, formatting doubles as validation — invalid JSON can’t be formatted.

It follows the strict JSON standard, so comments, trailing commas and single-quoted keys are rejected — the same rules an API or parser will apply. Key order and number precision are preserved as written; nothing is reordered or rounded.

Practical examples

Reading a minified API response

Paste a one-line response like {"id":42,"items":[{"sku":"A1","qty":3}]} and beautify it to see the structure indented and readable in seconds.

Shrinking JSON for a config or URL

Minify a formatted config file to remove whitespace before embedding it in a query string or an environment variable, where every byte counts.

Finding the syntax error

Paste JSON that won’t load and the parser points at the problem — a missing comma, an unquoted key, or a stray trailing comma — so you can fix it fast.

Frequently asked questions

Does the JSON I paste get uploaded anywhere?

No. Parsing and formatting happen entirely in your browser. You can disconnect from the internet after the page loads and it still works — important when the JSON contains tokens, keys or personal data.

What’s the difference between beautify and minify?

Beautify adds indentation and line breaks so JSON is easy to read; minify strips all optional whitespace to make the smallest possible string. The data is identical either way — only the formatting changes.

Why does it reject my JSON with comments or trailing commas?

Standard JSON allows neither. Formats like JSON5 or JSONC do, but a strict parser — which most APIs and libraries use — will reject them, so this tool does too, to match what your code will see.

Does formatting change my data?

No. Only whitespace changes. Keys keep their original order, strings and numbers are preserved exactly, and no fields are added, removed or rounded.

Can it validate JSON without reformatting?

Effectively yes — if the input is invalid, you get an error and no output. If it’s valid, you get the formatted result. There’s no way to have valid JSON that fails to format, so a successful format is a passed validation.

What do the error messages mean?

They come straight from the JavaScript JSON parser and usually name the unexpected character and its position. “Unexpected token } in JSON” typically means a missing value or a trailing comma just before it.

Is there a size limit?

No fixed limit, but very large documents (many megabytes) depend on your device’s memory since everything runs locally. For typical API responses and config files there’s no practical constraint.

Does it handle non-ASCII characters like č or emoji?

Yes. Unicode is preserved exactly in both beautify and minify modes; the tool never escapes or mangles accented letters or emoji.

Which indentation should I use?

Two spaces is the most common default and what many style guides and formatters use; four spaces or a tab suit teams that prefer them. Pick whichever matches your project — the choice is purely cosmetic.

Related tools