BrowserLeaksUSBrowserLeaksUS

JSON Formatter

Format, validate and minify JSON - fully client-side

JSON Formatter

Indent:

What this tool does

Pretty-prints and validates JSON. Minifies back to a single line when needed. Highlights syntax errors with line numbers. Runs client-side.

Who it's for: Developers inspecting API responses, log analysts reading JSON logs, and anyone struggling to read compressed JSON in the wild.

When to use

  • •Format a compressed JSON API response into something readable.
  • •Validate that user-submitted JSON is syntactically correct.
  • •Minify JSON for embedding in a URL or request body.
  • •Spot missing commas, unclosed brackets, or trailing commas.

How it works

  1. 1Paste JSON into the input area.
  2. 2Pretty-print with 2-space indent or minify to one line.
  3. 3Errors highlight exactly where the syntax breaks.
  4. 4All parsing is done by the browser's native JSON engine.

Tips

  • •Trailing commas are invalid in strict JSON - different from JavaScript.
  • •Keys MUST be double-quoted; single quotes or unquoted keys fail.
  • •Use JSON Schema for runtime validation, not just format-checking.

Using this result

How to read the JSON formatter

01

Pretty, compact, and the error line

The formatter parses the text you paste and prints it again. Pretty print adds indentation so objects and arrays are readable. Compact print removes that whitespace so the payload is smaller to copy into a header or a log. Neither mode changes the data. Object key order is preserved as parsed. Numbers stay numbers. The result is valid JSON if the input was valid JSON.

An error is a parse failure, and the message names the position. A trailing comma, a single quote, a comment, or a bare key are the usual causes. JavaScript object literals are not JSON. Undefined, NaN, and trailing commas will fail here even though a browser console accepts them. Fix the token the message points at, then format again. If the whole document is one quoted string, you pasted JSON that had already been stringified twice. Parse once, mentally, and paste the inner text.

02

What formatting does not validate

A green format only means the syntax is legal. It does not mean the object matches an API schema, that required fields are present, or that a signature is valid. A JWT pasted here is one string, so the formatter will show it as a string rather than as header and payload. Use the JWT Decoder for that. A large array that formats slowly is still only text. This page does not upload it.

Use the compact result when you are about to put JSON in a query string, then pass that result through URL Encode. Use pretty print when you are comparing two responses by eye. Whitespace differences disappear once both sides are formatted the same way, which is the point of the tool.