Skip to content

JSON Formatter

Format, validate and minify JSON locally, without uploading the data.

Runs entirely in your browser — nothing you enter is uploaded.

How to use JSON Formatter

  1. Paste your JSON into the input box.
  2. Choose an indent width, or select the minimal option.
  3. Click Format to get readable output, or Minify to strip all whitespace.
  4. If the input is invalid, check the highlighted position and line/column reference below the error.

How this works

Input is parsed with the browser's native JSON parser and re-serialised with the indentation you choose. Because parsing happens before formatting, invalid JSON is caught rather than silently reshaped, and the reported error carries the character offset so you can find the problem directly. Minifying re-serialises without whitespace. All of it runs in your browser — nothing you paste is transmitted, which matters when the payload is an API response containing tokens or customer data.

Assumptions

  • Strict RFC 8259 JSON. Trailing commas, comments, single quotes and unquoted keys are errors, not tolerated variations.
  • Object key order is preserved as written; the parser does not sort.
  • Numbers pass through IEEE 754 double precision, so integers beyond 2^53 lose exactness.

Worked example

A minified 2 KB API response with a missing closing brace.

Input
Minified JSON, 2,048 characters
Action
Format with 2-space indent
Result
Error reported at position 1,834

Rather than producing partly formatted output, the parse fails and points at the offset where the structure became invalid. On minified input that is usually the only practical way to locate an unbalanced brace, since there are no line breaks to scan.

How to read the result

Use formatted output while reading or debugging, and minified output for anything travelling over a network — whitespace can be a meaningful share of a small payload. If validation fails, the reported position is where the parser could no longer continue, which is often slightly after the actual mistake: an unclosed brace is reported at the end of input, not where it opened.

Limitations

  • Does not validate against a JSON Schema — it checks syntax, not whether the shape is correct for your application.
  • Very large documents are limited by available browser memory.
  • Large integers and high-precision decimals may lose exactness through double-precision parsing.

Frequently asked questions

Is my JSON uploaded anywhere?
No. Parsing, formatting and minifying all happen in your browser using the native JSON parser — nothing you paste is sent to a server, which matters if the payload contains tokens or customer data.
Why does the error point to the wrong place?
The parser reports where it could no longer continue, which is often after the actual mistake — an unclosed brace, for example, is reported at the very end of the input rather than where the opening brace was. Check the structure just before the highlighted position.
Can this validate my JSON against a schema?
No — it checks that the JSON is syntactically valid, not that its shape matches what your application expects. For schema validation you'll need a dedicated JSON Schema validator.