JSON Formatter

JSON Formatter

Paste any JSON and instantly format, validate, and syntax-highlight it — free online JSON formatter with tree view, graph view, and minifier. No install needed.

Shift + Enter to Copy · Shift + for tabs
1

Paste any JSON string and get it instantly formatted, validated, and syntax-highlighted with this free JSON formatter online — no installation, no sign-up, everything runs in your browser. Whether you're debugging a minified API response or cleaning up a config file, readable output appears the moment you type.

Beyond basic formatting, the tool includes a collapsible tree view, a visual graph layout, a searchable flat list, and a minifier — making it a complete JSON viewer and validator in one place.

How to Use the JSON Formatter

  1. Paste your JSON into the left input panel — minified, poorly indented, or already formatted.
  2. Read the output — the formatted result appears immediately in the right panel with syntax highlighting.
  3. Switch tabs to explore the JSON as a collapsible tree, a visual node graph, or a flat path list.
  4. Adjust indentation — choose 2-space or 4-space indent from the selector.
  5. Copy the result — click Copy to copy the formatted or minified output to your clipboard.

If the input is invalid JSON, an error message shows the exact location of the problem so you can fix it quickly.

JSON Formatting — Why It Matters

JSON sent over the wire is often minified: no spaces, no line breaks, everything on a single line. That's efficient for network transfer but unreadable for humans. Formatting it — adding consistent indentation and line breaks — makes the structure immediately visible: which keys are nested inside which objects, how many items are in each array, and where the data hierarchy begins and ends.

The tree and graph views take this further. The tree view lets you collapse and expand sections to focus on one part of a large JSON document. The graph view lays out nodes as cards, showing parent-child relationships at a glance — useful when trying to understand deeply nested or unfamiliar data structures.

Common Use Cases

  • Debugging API responses: Copy a raw JSON response body from your browser's Network tab or Postman and paste it here to read it as a structured, syntax-highlighted document instead of a single dense string.
  • Validating JSON config files: Before committing package.json, tsconfig.json, or any other JSON config to version control, paste it here to verify it's syntactically valid and catch trailing commas or missing quotes.
  • Minifying JSON for production: Use the Minify tab to strip all whitespace from a JSON payload before embedding it in code, a shell script, or an HTTP request body to reduce its size.
  • Exploring unfamiliar data structures: The tree view and graph view are ideal when you receive a large, deeply nested JSON document — from a database export, an API schema, or a webhook payload — and need to quickly understand its shape.
  • Teaching and learning JSON: The side-by-side input/output view with syntax highlighting is a great reference when learning how JSON structure maps to programming language data structures.
  • Fixing malformed JSON: The validator pinpoints the exact line and character where parsing failed, making it faster to identify issues like trailing commas, unquoted keys, or unclosed brackets.

Frequently Asked Questions

Why does my JSON show a "trailing comma" error?

Trailing commas (a comma after the last item in an array or object) are valid in JavaScript but explicitly forbidden in JSON. Remove the last comma before the closing ] or } and the input will parse correctly. Most linters and editors have an option to auto-fix trailing commas.

What is the difference between formatting and minifying JSON?

Formatting adds whitespace — indentation and line breaks — to make JSON readable for humans. Minifying removes all non-essential whitespace to produce the smallest possible string for network transfer. A 10 KB formatted JSON file can compress to 6–7 KB minified. Neither operation changes the data itself.

Can this tool format very large JSON files?

Yes, with caveats. Since processing happens in your browser's JavaScript engine, very large files (above a few hundred KB) may take a second or two to render and could slow the syntax highlighting. For files in the megabyte range, consider a local tool or editor extension instead.

Why must JSON keys be in double quotes?

The JSON specification (RFC 8259) explicitly requires object keys to be strings enclosed in double quotes. Single quotes and unquoted keys are valid in JavaScript object literals but not in JSON. This is a strict requirement for any JSON parser to accept the input.

What does the "Raw List" view show?

The raw list view extracts every leaf value from the JSON and presents it as a flat table with three columns: the full dot-notation path (e.g. user.address.city), the data type, and the value. It's useful for auditing all values in a document without navigating the nested structure.

Related Tools