JSON Formatter - Format, Validate & Minify JSON Online

Paste any JSON and format it instantly — beautify, minify, or validate with one click. Free, runs in your browser, nothing uploaded. No signup

Tool options

Output

Indentation

Options

Saved documents

Saved JSON stays in this browser - nothing is uploaded.

Paste JSON - it formats as you type.
Input
Output

Paste messy JSON and read it in seconds

Got a wall of JSON that looks like gibberish? Paste it above and this JSON formatter instantly adds indentation, line breaks, and color so you can actually read it. It also catches syntax errors before they crash your code.

How to use this JSON formatter

  1. Paste your JSON into the input box above (or upload a .json file).
  2. Choose your indent size — 2 spaces, 4 spaces, or a tab stop.
  3. Click Format to pretty-print, or Minify to compress it to one line.
  4. If there's a syntax error, the tool highlights the exact line and tells you what went wrong.
  5. Copy the result with one click or download it as a .json file.

Worked example: from raw to readable

Here's typical JSON straight from an API response — valid but completely unreadable:

{"user":{"id":42,"name":"Alice","roles":["admin","editor"],"active":true}}

After clicking Format with 2-space indent, you get:

{
  "user": {
    "id": 42,
    "name": "Alice",
    "roles": [
      "admin",
      "editor"
    ],
    "active": true
  }
}

Same data, zero ambiguity. You can immediately see the nested structure, spot the roles array, and check that active is a boolean — not the string "true".

Format JSON in your own code

Sometimes you need to pretty-print JSON directly in a script. Here's how to do it in the two most common languages:

JavaScript (Node.js or browser)

const raw = '{"user":{"id":42,"name":"Alice"}}';
const formatted = JSON.stringify(JSON.parse(raw), null, 2);
console.log(formatted);

JSON.stringify's third argument sets the indent — use 2 for two spaces or '\t' for tabs.

Python

import json

raw = '{"user": {"id": 42, "name": "Alice"}}'
formatted = json.dumps(json.loads(raw), indent=2)
print(formatted)

The indent parameter in json.dumps() does the same job. Pass sort_keys=True if you want keys in alphabetical order.

JSON format rules people get wrong

Most JSON errors come down to a handful of syntax mistakes. This table covers the ones that trip people up most often — useful to bookmark if you're writing JSON by hand.

Rule Correct Wrong
Keys must be double-quoted strings {"name": "Alice"} {name: "Alice"}
Strings use double quotes only {"city": "Paris"} {'city': 'Paris'}
No trailing comma after last item [1, 2, 3] [1, 2, 3,]
No comments allowed (no comments in JSON) // this breaks JSON
Valid value types string, number, boolean (true/false), null, object, array undefined, functions, dates (as objects)

The JSON spec is defined by RFC 8259, the authoritative standard from the IETF.

Format vs. minify vs. validate vs. query — what's the difference?

Format / beautify adds indentation and line breaks to make JSON easy for humans to read. Minify strips all whitespace to produce the smallest possible string — ideal for sending over a network or storing in a database. Validate checks whether the JSON is syntactically correct without changing it. JSONPath query lets you extract specific values from a large document using a path expression (like $.user.name) without reading the whole structure manually.

How it works

When you click Format, the tool parses your text using the browser's own JSON engine — the same parser that powers JSON.parse() in every modern browser. It then serializes the parsed object back to a string with your chosen indentation. Because all processing happens in your browser, nothing is ever uploaded to a server. Large files (up to 10 MB) are handled entirely on your device, so they stay private.

When to use a JSON formatter — and when not to

  • Use it when debugging API responses, config files, or log output that arrives as a single compressed line.
  • Use it before committing JSON to a repo — readable, consistently indented JSON is much easier to review in a diff.
  • Use it when you hit an error like Unexpected token and need to find the bad line fast.
  • Skip it if your file is JSON5, JSONC, or JSON with Comments — those allow single quotes and comments, which standard JSON doesn't. Use a dedicated JSON5 parser instead.
  • Skip it if you need schema validation (checking that fields have the right types and required keys exist) — that's a job for JSON Schema tools, not a formatter.

Related tools you might need

Paste your JSON above and get a clean, readable result in one click — no signup, no upload, no wait.

Frequently asked questions

Is my JSON data uploaded to your servers?+
No. Everything runs in your browser using the browser's own built-in JSON engine. Your data never leaves your device, so you can safely paste API keys, credentials, or private configs without worry.
What's the difference between formatting and beautifying JSON?+
They mean the same thing in practice — both add indentation and line breaks to make JSON easy to read. 'Beautify' and 'pretty-print' are just the more casual names for the same operation.
Can it handle large JSON files?+
Yes. Files up to 10 MB are processed entirely in your browser without any upload. For files larger than that, consider using a command-line tool like jq or Python's json.tool module instead.
How do I format JSON in VS Code?+
Open the file, then press Shift + Alt + F on Windows/Linux or Shift + Option + F on Mac. VS Code will format it using its built-in JSON formatter. Make sure the file is saved with a .json extension or the language mode is set to JSON.
Why do I get 'Unexpected token' errors?+
This usually means a syntax mistake: a missing comma between items, a trailing comma after the last item, a key that isn't in double quotes, or a single-quoted string. The formatter will highlight the problem line so you can fix it quickly.
Is this tool free? Do I need to sign up?+
Completely free, no account needed. Just paste your JSON and go.
How do I format JSON from the command line?+
With jq: run cat file.json | jq . — it pretty-prints with color. With Python (no install needed): run python3 -m json.tool file.json. Both are fast options for large files or automation scripts.
Can JSON have comments?+
No — standard JSON does not allow comments. This is one of the most common misconceptions. If you need comments in a config file, consider JSONC (used by VS Code) or YAML instead.