JSON Formatter & Validator

Pretty-print, validate, and minify JSON without your data leaving the browser.

How to format, validate, or minify

  1. Paste your JSON into the input box. Raw API responses, config files, and log fragments all work.
  2. Click Format (2 spaces) for standard pretty-printing, Format (4 spaces) if your team indents wider, or Minify to strip all whitespace.
  3. Check the status line. A green check means valid JSON and the result box fills; a red cross means a parse error with a position and an approximate line number.
  4. Click Copy result.

Validation is not a separate button because every operation validates first. If you only want to check a payload, click either Format button and read the status line.

A worked example, including a broken input

Paste {"name":"Ada","skills":["math","logic"],"active":true} and click Format (2 spaces): you get the same data spread over eight readable lines with each key on its own line and the array opened up. Click Minify and it collapses back to the 54 character single line, which is the form you want inside a curl command or a config value. Now break it deliberately by adding a comma after true. The status line turns red with the parser's exact complaint and a position, plus "(around line 1)". Trailing commas are the single most common JSON error, followed closely by unquoted keys and single quotes, and the error position lands on or just after the offending character in all three cases.

Under the hood

The tool is a thin, honest wrapper around your browser's native JSON.parse and JSON.stringify. That has two consequences worth knowing. First, validation is exactly as strict as the JSON specification: comments, trailing commas, and single-quoted strings all fail here even though some config formats tolerate them, so passing this validator means your payload will parse anywhere. Second, formatting is a full parse and re-serialize, not a text transformation, so the output is guaranteed syntactically perfect and duplicate keys are collapsed to the last value, the same way every JSON consumer would read them. The line hint in error messages is computed by counting newlines up to the parser's reported position. Nothing you paste leaves the page, which matters because real-world JSON is full of tokens and internal URLs.

Honest limitations

Because the input is fully re-serialized, the original key order is whatever the parser preserves and any formatting quirks of the source are gone; this is a formatter, not a diff-safe pretty printer. Numbers pass through JavaScript's floating point, so integers beyond 2^53 lose precision, a real concern for 64-bit IDs from APIs, which arrive looking fine and leave subtly rounded. Error messages come from your browser's parser, so their wording differs between Chrome, Firefox, and Safari, and the position hint is approximate for errors the parser only detects late. There is no tree view, no search, and no schema validation. For payloads that fit those needs this stays fast and private, and for gigabyte log files your browser tab, not the tool, will be the limit.

Frequently asked questions

Is it safe to paste API responses with tokens here?

The formatter runs entirely in your browser with JavaScript. Nothing you paste is transmitted or logged. Still, as a habit, avoid sharing tokens anywhere you don't control.

What do the error messages mean?

The validator uses your browser's native JSON parser and reports its exact error, plus the position where parsing failed — usually a missing comma, an unquoted key, or a trailing comma.

What is minified JSON for?

Minifying removes all whitespace, shrinking payload size for APIs and config files where humans don't need to read the raw text.