JSON Formatter & Validator: Fix Errors, Tree View

JSON Formatter & Validator: Fix Errors, Tree View

Format, validate and minify JSON with errors shown by line and column, one-click fixes for trailing commas and quotes, and tree or graph views.

Updated November 2026

Reviewed by Rafael Duarte

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, it's checked as you type. If it's invalid, you see your browser's error message, plus a line and column badge in Chrome, Edge and Firefox.

2. Fix and format

Click Fix to repair common mistakes, then read the Pretty Print output (2 or 4 spaces) or grab the Minify version.

3. Explore the structure

Switch to Tree, Graph or Raw List to see how the data is nested. Every tab updates as you edit.

What this JSON formatter does

Well beyond pretty-printing

Validates as you type

Invalid JSON shows the browser's own parser message. In Chrome, Edge and Firefox it also gets a badge such as L1:17 with the line and column; Safari doesn't report a position.

Repairs broken JSON

The Fix button uses jsonrepair to handle trailing commas, single quotes, unquoted keys, comments and missing closing brackets.

Tree, graph and path list views

A collapsible Tree, a Graph of node cards (up to 6 levels and 20 children per node) and a Raw List of every path, searchable with Ctrl+F.

Quick CSV export

Export CSV turns an array of objects into a comma-separated file, with headers taken 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",}
invalid: browser error message with an L1:17 badge (the trailing comma)
{}
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

Paste package.json or any JSON config to catch syntax errors such as trailing commas before you push. To check the structure itself (required fields, types), use the JSON Schema Validator.

Quick CSV export

Turn a simple array of objects into a comma-separated file. For CSV that opens cleanly in Excel, use the CSV to JSON Converter.

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, so {'name': 'Alice'} is invalid.

Unquoted key

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

Comments in JSON

JSON doesn't support // or /* */. Fix strips them; if you need comments to stay, use JSONC, YAML or TOML. More examples in How to Validate JSON and Find Syntax Errors.

Why format your JSON here

Minified JSON is efficient to transfer but hard for people to read. Formatting makes the structure visible at a glance: which keys live inside which objects, and how many items each array holds.

The Fix button, the collapsible tree, the graph and the path list cover the usual debugging steps in one place. Everything runs in your browser, and up to 20 named snippets can be saved in localStorage for later.

Frequently asked questions

Yes, it checks the syntax as you type. An error banner shows your browser's parser message and, in Chrome, Edge and Firefox, a line and column badge such as L1:17. To validate the structure against a schema, use the JSON Schema Validator.

References

Related Tools