Skip to content
AZ Tools

JSON Formatter & Validator

Paste raw or messy JSON and instantly pretty-print it with two-space, four-space or tab indentation, sort every object's keys alphabetically for stable diffs, or minify it down to a single compact line for transport. The formatter validates as it goes: if the input isn't valid JSON it points to the problem instead of producing silent garbage. It handles deeply nested structures, arrays, Unicode and large documents, all in your browser — your data is never uploaded, which matters when the JSON holds API responses, tokens or personal records. Use it to clean up logs, prepare test fixtures, or make an API payload readable.

Output

How to use

  1. Paste or type your JSON into the input area.
  2. Choose an indentation size and, optionally, sort keys alphabetically.
  3. Click Format to beautify, or Minify to compact the JSON.
  4. If the JSON is invalid, the error message points to the problem.
  5. Copy the formatted result with the Copy button.

Frequently asked questions

Is my JSON sent to a server?
No. All formatting and validation happens locally in your browser — nothing is uploaded.
What does sorting keys do?
It reorders every object's keys alphabetically, recursively, which makes diffs and comparisons easier.
Why do I get a syntax error?
The input isn't valid JSON. Common causes are trailing commas, single quotes, or unquoted keys.
Does minify change my data?
No. Minify only removes whitespace; the data and key order stay the same unless you also enable sorting.
What indentation options are there?
You can pretty-print with 2 spaces, 4 spaces or tabs, or minify to a single line with no whitespace. Two-space indentation is the most common convention for configuration files and API examples.
Does sorting keys work on nested objects?
Yes — sorting is applied recursively, so every object at every level has its keys ordered alphabetically. This produces a canonical form, so two JSON documents that differ only in key order can be compared as identical.

Guides on this topic

Related tools