JSON formatter.

Format, validate and minify JSON, with custom indentation and key sorting.

How do I format JSON?

Paste your raw or minified JSON into the box above and click 'Format & validate'. The tool will check that it's valid JSON and, if so, re-print it with your chosen indentation. If it isn't valid, you'll see an error explaining what's wrong and roughly where to find it.

Use the settings to switch between 2-space, 4-space or tab indentation, sort every object's keys alphabetically, or minify the output down to a single line with no whitespace at all.

What is JSON?

JSON (JavaScript Object Notation) is a lightweight, text-based format for structuring data as key/value pairs, arrays and nested objects. It's the de facto standard for APIs, configuration files and data interchange between servers and browsers because it's easy for both humans and machines to read.

Why format or validate JSON?

JSON returned from an API or stored in a config file is often minified into a single unreadable line. Formatting it with consistent indentation makes the structure easy to scan, spot missing commas or brackets, and compare against other payloads.

Validating catches syntax errors, such as trailing commas, unquoted keys or mismatched brackets, before they cause problems further down the line in your application.

Is my data sent anywhere?

No. Everything happens in your browser using JavaScript, nothing is uploaded or stored, so it's safe to use with sensitive data.

What does 'sort keys alphabetically' do?

When enabled, the keys of every object in your JSON are reordered alphabetically before formatting. This is useful for diffing two JSON documents, since key order otherwise has no effect on meaning but can make differences harder to spot.

What's the difference between formatting and minifying?

Formatting ('pretty printing') adds line breaks and indentation to make JSON easy to read. Minifying strips out all unnecessary whitespace to produce the smallest possible payload, which is useful when you need to embed JSON somewhere size-sensitive, like a URL query parameter.

No tools match your search.