Example data loaded — edit or paste your own JSON below.

Actions
SyntaxError

What This Tool Does

This tool performs three core operations on JSON data, all locally in your browser:

Format (Beautify) — Takes minified or messy JSON and applies consistent 2-space indentation with syntax-highlighted output. Keys, strings, numbers, booleans, and null values are color-coded so you can scan structure at a glance. Useful for code reviews, documentation examples, and understanding nested API responses.

Validate — Checks JSON syntax against RFC 8259. Reports the exact error type, line number, and column position for every issue it finds. Catches trailing commas, single quotes, unquoted keys, JavaScript comments, and undefined values before they cause runtime failures.

Minify (Compress) — Strips all non-semantic whitespace to produce the smallest valid JSON possible. Typical size reduction is 20-40% compared to formatted output. The data is structurally identical — only indentation and line breaks are removed. Use this for production API payloads, localStorage values, or embedded configuration blocks.

Beyond the three core operations, the tool includes a Repair function that automatically fixes common JSON syntax problems: it strips JavaScript comments, converts single quotes to double quotes, removes trailing commas, and replaces undefined with null. A Sort Keys option reorders all object keys alphabetically for consistent diffs and comparisons.

When You'll Need It

Debugging API Responses

Paste a single-line JSON blob from curl, Postman, or your HTTP client. Hit Format and immediately see nested object and array structure. No more manually counting braces or scrolling through a 2000-character unbroken line in a terminal window.

Reviewing Configuration Files

Validate package.json, tsconfig.json, CI/CD pipeline configs, Terraform state, or Ansible output before committing. A single trailing comma or unquoted key in a config file can break an entire deployment pipeline.

Inspecting Structured Logs

Observability tools often emit JSON log entries as single lines. Beautify them to trace a request across microservices, inspect error stack traces, or verify that PII redaction rules are working correctly across your log pipeline.

Before and After

A typical minified API response — the kind you get from curl or a REST client — becomes instantly scannable after formatting. The second example shows a configuration payload common in infrastructure-as-code workflows.

Raw (Minified, Single Line)
{"orders":[{"id":"ORD-001","items":[{"sku":"A100","qty":2,"price":9.99},{"sku":"B200","qty":1,"price":24.50}]}]}
Formatted (Indented, Readable)
{
  "orders": [
    {
      "id": "ORD-001",
      "items": [
        {
          "sku": "A100",
          "qty": 2,
          "price": 9.99
        },
        {
          "sku": "B200",
          "qty": 1,
          "price": 24.50
        }
      ]
    }
  ]
}
Raw Config Payload (162 chars)
{"server":{"host":"db01.internal","port":5432,"pool":{"min":5,"max":50,"idleTimeoutMs":30000}},"features":{"ssl":{"enabled":true,"mode":"verify-full"}}}
Formatted (500+ chars, Fully Indented)
{
  "server": {
    "host": "db01.internal",
    "port": 5432,
    "pool": {
      "min": 5,
      "max": 50,
      "idleTimeoutMs": 30000
    }
  },
  "features": {
    "ssl": {
      "enabled": true,
      "mode": "verify-full"
    }
  }
}

Common Errors and Their Fixes

These are the five most frequent JSON syntax errors the validator catches. Each one will break JSON.parse() in any language.

Error Cause Fix
Unexpected token } Trailing comma before a closing brace or bracket: {"a":1,} Delete the comma after the last element or key-value pair
Unexpected token ' Single quotes used for keys or string values: {'key':'value'} Replace all ' with ". JSON requires double quotes.
Unexpected token / JavaScript-style comments (// single-line or /* block */) Remove all comments. JSON has no comment syntax — use a separate README or schema file for documentation.
Unexpected token u undefined used as a value — a JavaScript-ism not valid in JSON Replace undefined with null, or omit the key entirely.
Unexpected token n Unquoted object key: {name: "Alice"} Wrap every key in double quotes: {"name": "Alice"}

For files over 50 MB, the in-browser JSON parser may become unresponsive due to memory pressure. Split the payload into smaller chunks, or use jq on the command line: jq . large-file.json. The Repair button can automatically fix trailing commas, single quotes, and comments — use it as a first pass before manual correction.

Frequently Asked Questions

Answers to the most common questions about formatting behavior, file size limits, data privacy, and compatibility with non-standard JSON dialects.

Does formatting change my data?

No. Formatting only adds indentation and line breaks — both are whitespace that does not affect JSON semantics. Minifying removes only non-semantic whitespace. In both cases, the data structure, key order, and all values are preserved exactly. Round-tripping (format then minify) produces output identical to the original minified input.

Why did my object keys get reordered?

The Sort Keys button reorders all object keys alphabetically. The JSON specification (RFC 8259) explicitly states that objects are unordered collections of name/value pairs, so alphabetical ordering is semantically valid. If you need to preserve insertion order, use the Format button instead — it keeps keys in their original positions. Most JSON parsers in modern languages (JavaScript, Python 3.7+, Go) do preserve insertion order at runtime, but you should not rely on this for data integrity.

Can this handle JSON5 or JSON with comments?

Standard validation mode follows RFC 8259 strictly and rejects JSON5 features: unquoted keys, single-quoted strings, trailing commas, // and /* */ comments, hexadecimal numbers, and explicit plus signs. Use the Repair button to automatically fix the most common issues: it strips comments, converts single quotes to double quotes, and removes trailing commas. For projects that rely heavily on JSON5 (e.g., certain build tools), use a dedicated JSON5 parser instead.

What is the largest file I can format?

There is no hard-coded size limit, but practical performance depends on available browser memory. Files under 10 MB typically format in under one second. Between 10 MB and 50 MB, expect a delay of a few seconds. Above 50 MB, the browser may show a "page unresponsive" warning as the JavaScript parser allocates memory for the parsed object tree. For payloads exceeding 100 MB, use a command-line tool: jq . large.json for formatting, or jq -c . large.json for minification.

Does this tool send my data anywhere?

No. All JSON processing — formatting, validation, minification, repair, syntax highlighting, and key sorting — runs entirely in your browser's JavaScript engine. No data is ever transmitted to any server. You can verify this by disconnecting your internet connection after the page loads: the tool continues to work without any loss of functionality. This makes it safe for formatting JSON that contains API keys, authentication tokens, customer data, or proprietary business logic.