JSON toolbox

Format / minify / escape / diagnose — everything runs in your browser.

Result

How to use it

  1. Paste JSON or any text on the left, then pick an action above: Format, Minify, Escape, Unescape or Diagnose.
  2. “Indent” only affects Format (2 or 4 spaces); “Load sample” and “Broken sample” fill in demo data in one click.
  3. When something is wrong the message names the line and column; copy or download the result, and use ⇄ to move it back into the input.

Example

Input

{"user":{"id":42,"name":"Ada Lovelace","roles":["admin","editor"],"active":true},"score":12345678901234567890}

Formatted

{
  "user": {
    "id": 42,
    "name": "Ada Lovelace",
    "roles": [
      "admin",
      "editor"
    ],
    "active": true
  },
  "score": 12345678901234567890
}

Default rules only: 2-space indentation, keys in the order you wrote them. The 20-digit score is printed digit for digit — a JSON.parse round trip would turn it into 12345678901234567000.

Rules, limits and known issues

  • Strict JSON (RFC 8259): comments, trailing commas, single quotes, unquoted keys, NaN and Infinity are rejected, and the message names the fix rather than quoting the parser.
  • Format and Minify change whitespace only. String escapes, number literals and quoted keys are printed exactly as typed: "\u00e9" stays "\u00e9", 12345678901234567890 stays exact, 1e400 does not become null, -0 stays -0.
  • Duplicate keys keep the last value, as JSON.parse does, and a warning names the key. The earlier value is dropped.
  • “Escape” encodes the whole input into one JSON string literal (quotes, backslashes and control characters get escaped; everything else is untouched). “Unescape” accepts a complete quoted string (strictly checked) or bare escape sequences.
  • “Diagnose” only validates and measures (characters, lines, depth, keys) — it does not produce a formatted result; duplicates are still reported.
  • Line and column numbers count Unicode code points, so an emoji is one column. Only space, tab, line feed and carriage return count as whitespace; U+3000 or U+00A0 is reported with its code point.
  • Limits: 1,000,000 characters and 512 nesting levels. Over either limit you get an error, never a truncated result. File upload reads the local file only — nothing is uploaded.
  • No JSON→YAML/XML/CSV conversion, no JSON Schema, no JSONPath, no tree editor, no URL parameters, no history. Everything runs in your browser: nothing is uploaded or stored.

What people usually need next, once the JSON is done.