JSON Formatter & Validator

JSON Formatter & Validator

Free online JSON formatter & validator — format, validate, minify, and export JSON to CSV. Tree view, graph view, and syntax highlighting. No install needed.

Updated May 2026

Shift + Enter to Copy · Shift + for tabs
1

How this JSON formatter works

Three steps to the output you need

1. Paste your JSON

Minified, badly indented, or already formatted — validation runs instantly, with the exact line and column of any error.

2. See the result

Formatted output with syntax highlighting by type: strings, numbers, booleans, nulls.

3. Explore or export

Collapsible tree, visual graph, flat list, or CSV export — every tab updates automatically.

What this JSON formatter does

Well beyond pretty-printing

Validates with exact line and column

A syntax error shows precisely where the parse failed, before it tries to produce any output.

Auto-repairs broken JSON

The Fix button uses jsonrepair to fix trailing commas, single quotes, and JSONC-style comments.

Tree, graph, and flat list views

Three ways to explore the structure — collapsible tree, visual node cards, or searchable paths with Ctrl+F.

Exports to CSV

An array of objects becomes a CSV file with headers derived automatically from the keys.

Minifies

Strips all whitespace to shrink the payload before embedding it in code.

Saves snippets

Up to 20 named snippets persist in localStorage between sessions.

Examples

Input
Result
{"name":"Alice","age":30}
formatted object with 2-space indentation
{"user":{"profile":{"name":"Bob"}}}
3-level collapsible tree
{"name": "Alice",}
error: trailing comma at line 1, column 17
{}
empty object — green "Valid JSON" badge

When you'll reach for a JSON formatter

The most common scenarios people use this for

Debugging an API response

Paste the raw body from the Network tab or Postman to read it with syntax highlighting.

Validating config before a commit

package.json, tsconfig.json, or any config file — catch trailing commas before you push.

Exporting to CSV

Turn an array of objects into a file ready for Excel or Google Sheets.

Minifying for production

Strip whitespace before embedding the payload in an HTTP request.

Exploring unfamiliar data

The tree and graph views make it fast to understand the shape of a large, deeply nested JSON payload.

Invalid JSON? Start here

Trailing comma

Valid in JavaScript, forbidden in JSON (RFC 8259). {"name": "Alice",} fails — remove the comma or click Fix.

Single quotes

JSON requires double quotes for keys and string values — {'name': 'Alice'} is invalid.

Unquoted key

{name: "Alice"} is valid JavaScript, but JSON requires {"name": "Alice"}.

Comments in JSON

JSON doesn't support // or /* */. Need comments? Use JSONC, YAML, or TOML instead.

Why format your JSON here

Minified JSON is efficient to transfer but unreadable for humans — formatting makes the structure immediately visible: which keys live inside which objects, how many items each array holds.

Beyond basic pretty-printing, the CSV export, collapsible tree, and visual graph cover the most common debugging workflows in one place, without switching tools.

Frequently asked questions

Yes. It validates as you type — an error banner shows the exact line and position. Common problems (trailing commas, missing quotes, an unclosed bracket) get a one-click fix via the Fix button.

References

Related Tools