Structured Data

JSON Formatter

Paste JSON to beautify or minify it with your choice of indentation. Validation, size comparison and a friendly error location update as you type — and your data never leaves the page.

Runs in your browser v1.0.0

Options

live

JSON input

paste or type

Parsed with JSON.parse in this tab. Invalid input is reported with a line and column instead of failing silently.

Formatted output

live


                

How it works

The input is parsed with the browser’s own JSON.parse and re-serialised with JSON.stringify, so the output is always standards-compliant JSON. Because parsing happens against the JavaScript object model, duplicate keys keep the last value, very large numbers may lose precision, and comments or trailing commas are rejected with a line and column so you can fix them quickly. Everything runs locally and nothing is uploaded.

Practical uses

Format, minify, or sort JSON and locate syntax errors with a line and column.

Common ways to use it

  • Make a minified API response readable while debugging a payload.
  • Shrink a JSON document before pasting it into a config or commit.
  • Sort object keys so two JSON documents are easier to compare by eye.

Minify and sort keys

Input

{"b":2,"a":1}

Output

{"a":1,"b":2}

Verified with "Minify" and "Sort keys" both enabled. With Minify off the same input is pretty-printed with the selected indentation; sorting runs recursively over objects and leaves array order unchanged.

Options that matter

  • Indentation — 2 spaces, 4 spaces, or a tab; used only when Minify is off, and the selector is disabled while Minify is on.
  • Minify — serialise to a single line with no spaces.
  • Sort keys — order object keys alphabetically at every depth; array order is preserved.

Things to keep in mind

  • Input is parsed with the browser's JSON.parse, so comments, trailing commas, and single quotes are rejected.
  • Large integers can lose precision because JSON numbers become JavaScript numbers.
  • Duplicate keys keep the last value.