Skip to content

JSON Formatter

Pretty-print JSON with your choice of indentation, optionally sorting keys so two payloads can be compared.

Input

Output

Formatting and comparing

Minified JSON from an API response becomes readable in one step, with the indentation your codebase uses.

Sorting keys is what makes two responses comparable: the same object serialized by two different services often differs only in key order, and sorting removes that noise before you diff them.

Why paste API responses here rather than into a random formatter

API responses routinely contain access tokens, email addresses and customer records. Most online formatters post the payload to a server to format it there. This one parses and re-serializes in the page — there is no endpoint to send it to.

Frequently asked questions

Does formatting change my data?

Only whitespace, and key order if you enable sorting. Values, types and structure are preserved exactly, since the JSON is parsed and re-serialized rather than edited as text.

Why did my large numbers change?

JSON numbers are parsed as IEEE 754 doubles, so integers beyond 2⁵³ lose precision. That is a property of JSON itself — ids that large should be transmitted as strings.

Can it handle JSON with comments or trailing commas?

No. Those are JSON5 or JSONC extensions, not valid JSON, and the validator will point at the exact position where parsing stopped.

Related tools