JSON Formatter

100% Client-Side
Privacy: 100% Client-Side. Your data never leaves this browser tab. Processing uses Web APIs and client-side libraries only.

Validate JSON strictly (RFC 8259) with line and column errors, then pretty-print, minify or sort keys without rounding big numbers.

Local History: ON

Input persists in localStorage and syncs to #data= for shareable links (small payloads).

✓ Valid JSON (RFC 8259). Numbers and strings are kept exactly as written.

{
  "hello": "stbox",
  "ok": true
}

What does the JSON formatter do?

It validates JSON strictly against RFC 8259, the JSON standard, and points to the exact line and column of the first error, with a hint for the usual mistakes: trailing commas, comments, single quotes, unquoted keys, NaN or leading zeros.

Formatting is lossless. Unlike JSON.parse followed by JSON.stringify, it never rounds numbers past 2^53, turns 1e400 into null, rewrites 1.0 as 1, decodes escapes or drops duplicate keys; it only changes whitespace (and key order, if you ask). Duplicate keys and numbers JavaScript would round are flagged.

How to use this tool

  1. Paste JSON into the input. It is checked as you type.
  2. Choose an indent (2 spaces, 4 spaces or tab) and whether to sort keys.
  3. Copy the pretty or minified result, or use Prettify / Minify to rewrite the input.

Frequently asked questions

Why not just use JSON.stringify?

Because it changes data: 12345678901234567890 becomes 12345678901234567000, 1e400 becomes null and only the last of two duplicate keys survives. This formatter keeps every value as written.

Can I format JSON in other stbox tools?

Yes. Any stbox text box that holds a JSON object or array shows Format, Minify and Copy buttons in its corner.

Is JSON uploaded?

No. Formatting and validation are client-side only.