JSON Formatter

Paste minified JSON and read it. Indentation, key sorting and precise error positions — all in the browser.

Runs in your browser — nothing is uploaded

Formatted output

About the JSON Formatter

A minified API response is one long line. This formatter re-indents it so you can walk the nesting, confirm field names and spot the part that does not match your expectation.

If the input will not parse, you get the reason plus the line and column where it failed — not just “Unexpected token”. The three usual culprits are a trailing comma, single-quoted strings, and comments, none of which standard JSON (RFC 8259) allows.

Formatting happens locally with JavaScript. Nothing is sent to a server, so it is safe to paste responses containing customer data or tokens.

FAQ

JSON Formatter — frequently asked

Does this JSON formatter upload my data?

No. Parsing and formatting run in your browser using the built-in JSON parser. The page makes no network request with your input, so payloads containing personal data, order IDs or access tokens never leave your machine.

Why does my JSON fail to parse?

Almost always one of three things: a trailing comma after the last element of an object or array, strings wrapped in single quotes instead of double quotes, or // and /* */ comments. Standard JSON allows none of them. If you copied a JavaScript object literal or a VS Code settings file (which is JSONC), you will hit this.

Should I use 2 or 4 spaces?

It only affects readability, not validity. Two spaces is the common default for JavaScript and TypeScript projects and keeps deeply nested payloads narrow enough to read; four spaces is easier to scan for shallow documents. Pick whichever matches the file you are pasting into.

What does “sort keys” do?

It reorders object keys alphabetically, recursively through nested objects. JSON itself does not define key order and most servers make no guarantee about it, so sorting both sides is the reliable way to make two payloads comparable before you diff them.

Is there a size limit?

There is no hard cap, but everything runs on the main thread in your browser, so very large documents (tens of megabytes) will feel sluggish. For files that big, formatting locally with jq or a code editor will be faster.

Can I format JSON Lines or NDJSON here?

Not directly — JSON Lines is one independent JSON document per line, which is not itself valid JSON. Format a single line at a time, or wrap the lines in an array with commas between them first.

    Report an issue