Skip to content
UniKit

JSON Formatter

JSON minify and format with real `JSON.parse` validation (invalid JSON raises `invalid-json`), preserving key order, indent selectable 2/4/tab.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

JSON text

Result

The result can be copied directly.

Enter JSON to see the result

Characters: 0 · Lines: 0

What this tool does

  • Expand a one-line API response into readable JSON while preserving key order.
  • Collapse formatted JSON to a single line for logs or the command line.
  • Quickly confirm whether a snippet is valid JSON at all.

Example

Input

{"a":1,"b":[2,3]}

Output

{
  "a": 1,
  "b": [
    2,
    3
  ]
}

Validated with `JSON.parse`: invalid JSON raises `invalid-json` instead of printing a plausible-looking result.

Frequently asked questions

Is key order preserved?

Yes. `JSON.stringify` emits insertion order, matching the input.

JSON5 or comments?

Not supported — this is strict JSON; use a JSON5 tool for commented configs.

Do big numbers lose precision?

Yes, integers beyond 2^53−1 become floats after `JSON.parse`, matching the browser; store them as strings for exactness.

Why does invalid JSON fail?

Because `JSON.parse` runs first. Failing loudly beats printing a result that only looks formatted.

Keywords:formatjsonformatconverterdeveloper

Related tools