Skip to main content

JSON Formatter

Format and beautify JSON data with syntax highlighting and collapsible tree view.

formatbeautifypretty-print
Read the guide
Shortcuts:⌘ KSearch

Frequently Asked Questions

Does this format JSON as I type, or only when I click Format?

It auto-formats about 400ms after you stop typing. The Format button and Ctrl/Cmd+Enter just trigger the same formatter immediately.

Can I switch between 2 spaces, 4 spaces, and tabs?

Yes. The indent dropdown feeds straight into JSON.stringify, so the output and downloaded file use 2 spaces, 4 spaces, or a literal tab.

Why is valid JavaScript object syntax failing here?

This tool uses JSON.parse, not a JS parser. Trailing commas, single-quoted strings, comments, and unquoted keys will all fail even if a JS object literal would accept them.

Can I drag and drop a .json file into it?

Yes. Dropping a file onto the input loads it with FileReader and immediately runs the formatter.

What do the size, lines, and keys stats actually count?

Size is the byte size of the formatted output, lines is the formatted line count, and the last stat recursively counts object keys. Arrays are walked, but primitive values do not increase that key count.

Related Tools