JSON Formatter

Format, beautify, validate, minify, repair and explore JSON in a tree view — with key sorting, escaping and pinpoint error locations.

Ln 1, Col 1 0 characters

Options

Transform

Statistics

0 B
Size
0
Lines
0
Keys
0
Depth

About the JSON Formatter

This free JSON formatter beautifies, minifies and validates JSON entirely in your browser. Paste a compact API response to pretty-print it with your choice of indentation, collapse a deeply nested object in the tree viewer, or repair JSON that won't parse because of a trailing comma or unquoted key. When something is wrong, the validator pinpoints the exact line and column with a caret so you can fix it in seconds rather than hunting through one long line.

It's a daily helper for developers debugging APIs, editing config files and inspecting log payloads. Beyond formatting you can sort keys alphabetically, escape or unescape JSON strings, watch live stats for size, line count, key count and nesting depth, and upload a .json file or download the result. Because everything runs on your browser's native JSON engine, even large documents process instantly and nothing you paste is ever uploaded to a server.

Frequently asked questions

Answers to the questions we hear most about this tool.

What's the difference between formatting and validating JSON?

Validating only checks whether the text is well-formed JSON and reports the first error it finds, without changing anything. Formatting re-indents valid JSON into a readable, properly nested structure (and minifying does the reverse). Every format and minify also validates first, so if your JSON is broken you'll get a precise error instead of mangled output.

Can it repair broken or invalid JSON?

Yes. The repair option fixes the most common mistakes automatically — trailing commas, single quotes instead of double quotes, missing quotes around keys, and stray comments — and returns clean, valid JSON. It's great for pasting a loose object copied from JavaScript or a log, but always review the result, since repairing genuinely ambiguous input involves a few assumptions.

How does the JSON tree viewer help?

The interactive tree view turns your JSON into a collapsible outline so you can expand and collapse objects and arrays instead of scrolling through raw text. It's the fastest way to understand the shape of a large API response or find one value buried several levels deep, and it works alongside the formatted text — your data stays in the browser the whole time.

Can I sort the keys in a JSON object?

Yes. Sorting reorders every object's keys alphabetically, recursively through nested objects, while leaving array order untouched. This makes two JSON documents easier to compare or diff and gives configuration files a predictable, consistent layout.

Will it handle large JSON files without slowing down or sending them anywhere?

It should. The tool uses your browser's built-in, highly optimized JSON engine, so formatting and validating multi-megabyte files is typically near-instant. You can upload a .json file directly, and because all processing happens locally, even big or sensitive files never leave your device.