JSON Formatter

Beautify, minify and validate JSON, with a collapsible tree view and JSON-to-CSV export.

Runs in your browser. Nothing is uploaded.
How to use

JSON Formatter in 3 steps

Paste your JSON

Add any JSON — an API response, config file, or hand-written object.

Beautify, minify or validate

Pick 2- or 4-space beautify for readability, minify for a compact single line, or validate to check for errors.

Explore or export

Browse the collapsible tree view, copy the formatted result, or export a flat array as CSV.

Features

Why use this JSON Formatter

Beautify with 2 or 4-space indentation, or minify to one compact line.
Validation shows the exact line and column of a syntax error.
Collapsible tree view for exploring deeply nested objects and arrays.
Export a flat JSON array of objects straight to CSV.
FAQ

Questions about this tool

How does the error line number work?

When your JSON is invalid, this tool locates the exact character position the parser failed at and converts it to a line and column number, so you can jump straight to the problem instead of scanning the whole file.

What JSON structure works with JSON → CSV?

It works best on a flat array of objects with similar keys, like [{"name":"A","age":1},{"name":"B","age":2}] — each object becomes one CSV row and each unique key becomes a column.

Does beautifying change the data?

No — beautifying and minifying only change whitespace and formatting. The underlying values, keys, and structure stay exactly the same.

Can I collapse and expand parts of the tree view?

Yes, click any object or array node in the tree view to collapse or expand it, which is useful for focusing on one part of a large JSON document.

Practical example

See Read and fix a JSON formatting error for a worked example and the checks to make before using your result.