{}JSONFiddleEditor
Tools/

JSON Formatter

Beautify or minify JSON with syntax highlighting.

Turn unreadable JSON into something you can actually work with

APIs return minified JSON to save bytes. Log aggregators spit out single-line blobs. Config generators strip whitespace. The result is always the same: a wall of text you can’t parse with your eyes. This formatter takes that compact mess and applies consistent 2-space indentation, line breaks, and syntax coloring so you can see the structure at a glance. Going the other way, Minify mode strips all whitespace down to a single line for when you need the smallest possible payload.

How to format

  1. 1Paste raw JSON into the left editor — minified, messy, or partially indented.
  2. 2Choose Beautify for readable output or Minify for compact output.
  3. 3Click Format. The result renders on the right with full syntax highlighting.
  4. 4If the input is malformed, you’ll see a specific error pointing to the problem.

Under the hood

  • Beautify + Minify — Two modes, one tool. Pretty-print for reading, minify for transport.
  • `CodeMirror` editor — Syntax highlighting, line numbers, code folding, and bracket matching in both panels.
  • Precise error reporting — Invalid JSON triggers a parse error with the exact position of the problem — no generic "invalid input" messages.
  • Handles large documents — The editor virtualizes rendering, so even multi-MB files scroll smoothly without freezing the tab.
  • Completely offline — No data leaves your browser. JSON.parse and JSON.stringify run locally in JavaScript.

Real-world scenarios

  • API response inspection — Paste a curl response to understand the shape of a deeply nested payload.
  • Config cleanup — Reformat package.json, tsconfig.json, or .eslintrc after a messy merge.
  • Log triage — Pull a structured log line from Datadog or CloudWatch and expand it to see what’s inside.
  • Documentation prep — Beautify sample payloads before pasting them into API docs or READMEs.
  • Minification for embedding — Collapse a config object to one line for embedding in shell scripts or environment variables.

Before and after

// Minified (hard to read):
{"users":[{"name":"Alice","role":"admin","active":true},{"name":"Bob","role":"viewer","active":false}]}

// Beautified (scannable):
{
  "users": [
    {
      "name": "Alice",
      "role": "admin",
      "active": true
    },
    {
      "name": "Bob",
      "role": "viewer",
      "active": false
    }
  ]
}

Questions

Is anything uploaded?

No. Formatting uses JSON.parse and JSON.stringify in your browser. There’s no backend, no API call, no logging of your input.

My JSON has a syntax error — can this fix it?

Not automatically. The tool will tell you exactly where the error is (line and character offset) so you can fix it yourself. Common culprits: trailing commas, unquoted keys, single quotes instead of double quotes.

Can I change the indentation?

Currently fixed at 2 spaces, which is the most widely used convention for JSON. Tab or 4-space options may come in a future update.

How large can the input be?

The editor uses virtualized rendering, so files up to several megabytes work without performance issues. For 100MB+ files, consider using a CLI tool like jq.

Related tools