Skip to main content

JSON Formatter

Format, minify or browse JSON as a tree, with the line and column of any syntax error.

JSON

Result

Size
—
Depth
—
Keys
—
Values
—
Indent
View

The formatted JSON appears here.

Runs in your browser; nothing you enter leaves this page.

How it works

Formatting and minifying

The text is parsed with the browser’s own JSON parser, then written back out with the indent you pick: two spaces, four spaces or tabs. Minify writes it on one line with no spaces at all.

Key order and every value are kept exactly as they were. Numbers too long for JavaScript to hold exactly are the one exception: they come back rounded, as they would in any browser.

Finding the error

When the text is not valid JSON, the parser’s message is shown with the line and column it points at. The usual causes are a trailing comma, single quotes, a comment, or a key without quotes.

Size, depth, keys and values

Size is the formatted text in bytes. Depth is how many objects and arrays are nested inside each other. Keys counts object keys at every level, and values counts the strings, numbers, booleans and nulls at the leaves.

More tools

All 238 tools