← All tools

JSON formatter & validator

Prettify, minify and validate JSON. Private — in your browser

How to use the JSON formatter

  1. Paste your JSON into the input box — a minified API response, a config file, a request body from your network tab — and pick an indent style: 2 spaces (the default), 4 spaces, or tabs.
  2. Click Format to pretty-print with your chosen indentation, or Minify to strip every byte of optional whitespace for the smallest possible payload.
  3. Watch the status line: green means valid JSON, red shows the parser's error message — which in most browsers points at the exact line and column of the problem.
  4. Fix the input and click again; the output box only ever contains the result of a successful parse.
  5. Hit Copy result to grab the output.

Common uses

  • Pretty-print a one-line API response from curl or the browser's network tab so you can actually read the structure before writing code against it.
  • Minify a payload before embedding it in code, a data attribute or an HTTP request where size matters.
  • Validate hand-edited files like package.json — a stray trailing comma is caught in seconds here instead of at deploy time.
  • Normalize two payloads to the same indentation, then paste them into the diff checker to see what actually changed.
  • Debug a server's “invalid JSON” complaint: paste the rejected string and get the position of the first illegal character.

Tips & limitations

  • It's strict, spec-compliant JSON: comments, trailing commas, single quotes and unquoted keys are all rejected. A file that looks fine in VS Code may be JSONC (JSON with comments), which is a different format.
  • Integers above 2^53 get rounded, because JavaScript parses numbers as 64-bit floats — 9007199254740993 silently becomes …992. Keep 64-bit IDs (Twitter/Discord snowflakes, database keys) quoted as strings if the digits matter.
  • Duplicate keys don't raise an error: the last occurrence quietly wins, exactly as in JavaScript itself. Don't rely on this tool to catch them.
  • Key order is preserved as written, with one exception — keys that look like integers ("2", "10") are re-sorted numerically ahead of the rest, a JavaScript object rule the formatter inherits.
  • One document at a time: NDJSON and log files with one JSON object per line have to be formatted line by line.

How it's built & why it's safe

Parsing and printing use the browser's built-in JSON.parse and JSON.stringify — the same engine your JavaScript runs on — with the indent option passed straight through. There's no library, no server round-trip and no storage: payloads full of tokens, emails or customer records never leave the page, and the whole tool is a 40-line script you can read with View Source. Once loaded, it works offline too.

Related tools: YAML ⇄ JSON Converter · CSV ⇄ JSON Converter · JWT Decoder · Diff Checker

Further reading: JSON vs YAML vs CSV: choosing a data format

Frequently asked questions

What's the difference between Format and Minify?

Both validate first, then re-print the same data. Format adds line breaks and your chosen indentation so humans can read it; Minify removes all optional whitespace so the payload ships in the fewest bytes.

Does it validate my JSON?

Yes — every click runs a full parse before printing, and nothing reaches the output box unless the parse succeeded. On failure the status line shows your browser's parser error, which usually includes the line and column of the first problem.

Why is JSON that works in my editor rejected here?

Editors often accept JSONC or JSON5 — relaxed dialects that allow comments, trailing commas and unquoted keys. The JSON specification allows none of those, and this tool follows the spec, which is what production APIs and parsers expect.

Why did my long numeric ID come back slightly different?

JavaScript stores numbers as 64-bit floats, so integers beyond 2^53 lose precision — 9007199254740993 re-serializes as 9007199254740992. If you work with 64-bit IDs, keep them as quoted strings in your JSON.

Is my JSON uploaded anywhere?

No. Parsing happens entirely in your browser with its built-in JSON engine; nothing is stored or sent, and the tool keeps working with the network unplugged. It's safe for payloads containing keys, tokens or personal data.

Is there a size limit?

There's no limit in the tool itself — it's bounded only by browser memory, and multi-megabyte documents parse fine. Very large outputs can make the textarea sluggish to scroll, but that's rendering, not parsing.