{}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 + MinifyTwo modes, one tool. Pretty-print for reading, minify for transport.
  • `CodeMirror` editorSyntax highlighting, line numbers, code folding, and bracket matching in both panels.
  • Precise error reportingInvalid JSON triggers a parse error with the exact position of the problem — no generic "invalid input" messages.
  • Handles large documentsThe editor virtualizes rendering, so even multi-MB files scroll smoothly without freezing the tab.
  • Completely offlineNo data leaves your browser. JSON.parse and JSON.stringify run locally in JavaScript.

Real-world scenarios

  • API response inspectionPaste a curl response to understand the shape of a deeply nested payload.
  • Config cleanupReformat package.json, tsconfig.json, or .eslintrc after a messy merge.
  • Log triagePull a structured log line from Datadog or CloudWatch and expand it to see what’s inside.
  • Documentation prepBeautify sample payloads before pasting them into API docs or READMEs.
  • Minification for embeddingCollapse 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