JSON Formatter

Format and minify JSON data

Indent:

This formatter expands minified API responses into indented, readable structure — and compresses them back down when you need the smallest possible payload. Parsing happens in your browser, so what you paste never leaves this machine. That matters more for JSON than for most formats: the thing people paste into a formatter is usually a live API response carrying access tokens, order records, or customer email addresses.

How to use it

  1. Paste JSON into the input box — minified, badly wrapped, or copied straight out of browser DevTools all work.
  2. Pick an indent: 2 spaces (the convention in most JavaScript projects), 4 spaces, or a tab.
  3. Press Format to expand it, or Minify to strip every byte of unnecessary whitespace.
  4. If parsing fails, you get the browser's own error message plus the line the parser gave up on.
  5. Copy the result with the button above the output. Nothing is uploaded, and closing the tab discards everything.

When it comes in handy

Read a minified API response

Production APIs return single-line JSON with no whitespace. Formatting it makes the nesting visible immediately, which beats counting brackets in a terminal.

Check a hand-edited config before saving it

A stray comma in package.json, tsconfig.json, or composer.json is the classic hand-editing mistake. Format it first and you get the line number now, instead of a failed build later.

Make two JSON files comparable

Before diffing JSON from two different sources, format both with the same indent. The diff then shows real differences rather than formatting noise.

Shrink a payload before sending it

JSON going into an environment variable, a QR code, or a URL parameter should be as short as possible. Minifying keeps the data identical while typically cutting 20–40% of the bytes.

Limits and behavior

  • This follows the strict JSON specification, not JavaScript object syntax. Trailing commas, single quotes, // comments, and unquoted keys are all errors — not a limitation of this tool, but of JSON itself.
  • Integers above 2^53 (about 9 quadrillion) lose precision. Snowflake IDs and Twitter or Discord message IDs can come out with different trailing digits. If you need them intact, have your backend send them as strings.
  • When a key appears twice at the same level, only the last one survives. That is standard parser behavior, not a bug.
  • Parsing is synchronous and loads the whole document into memory. A few hundred kilobytes is fine; a few tens of megabytes will freeze the tab for seconds. At that size, reach for jq on the command line.
  • This tool only formats and minifies. It does not validate against a JSON Schema, sort keys, or evaluate JSONPath queries. It tells you whether the syntax is legal, not whether the structure is what you expected.

Frequently asked questions

My JSON looks fine. Why does it keep reporting an error?

Four causes account for almost all of it: a trailing comma after the last element; strings in single quotes instead of double; unquoted keys; and // or /* */ comments. All four are legal JavaScript and illegal JSON. The sneakier one is invisible characters picked up when copying from a web page — a full-width space or a byte order mark.

Is my data uploaded anywhere?

No. Formatting uses the browser's built-in JSON.parse and JSON.stringify, which run on your device and finish there; no request carries your input anywhere. You can verify it by disconnecting from the network and formatting again — the tool still works. The page itself loads third-party resources such as ads, but those requests contain none of what you paste.

Does minifying change my data?

The values do not change, but two things do: all indentation and line breaks are removed, and numbers are normalized (1.0 becomes 1, 1e3 becomes 1000). If anything downstream signs or hashes the raw JSON string, the signature will not match across a minify.

Why is the error wording different on my colleague's machine?

The message comes straight from the browser's JavaScript engine, and Chrome (V8), Firefox (SpiderMonkey), and Safari (JavaScriptCore) all word it differently. The line hint is calculated by this tool from the character offset the engine reports: it marks where parsing stopped, which is sometimes one line after the actual mistake.

Can it format JSON Lines (.jsonl)?

No. The whole input is parsed as a single JSON value, so a file with one object per line fails on line two. Paste one line at a time, or use a tool built for JSON Lines.