How to format JSON
- Paste your JSON into Input, drop a
.jsonfile anywhere on the page, or press Open file. - Pick the Indent: 2 spaces, 4 spaces, a tab, or Minified for a single line. Switch to Tree to browse nested data.
- Turn on Sort keys if you want a stable order for comparing two files.
- Select Copy (or press Ctrl+Shift+C) to put the result on your clipboard, or Download to save
formatted.json.
The result updates as you type. If the input is not valid JSON, you see the problem and its line and column instead of a result. Fix the spot and the output returns.
What JSON is
JSON (JavaScript Object Notation) is the text format most web APIs, config files and databases use to exchange data. It has objects in curly braces, arrays in square brackets, strings in double quotes, numbers, true, false and null. It is strict: no comments, no trailing commas and no single quotes. That strictness is why a single missing quote can break a whole request.
When to use each style
- Pretty-printed (2 or 4 spaces) is for reading, code review and documentation.
- Minified removes every optional space and line break. Use it to shrink a payload or put JSON in a single environment variable.
- Sorted keys make two versions of the same object easy to compare line by line.
Tips
- Only checking syntax? Use the JSON validator, which also warns about duplicate keys.
- Need a config file? Convert with JSON to YAML. Want types? Try JSON to TypeScript.
- Looking for one value in a big file? Use a JSONPath query.
- Sorting treats keys as plain text, so uppercase letters come before lowercase ones.
- Keys that look like whole numbers, such as
"10"and"2", always stay in numeric order, because that is how JavaScript objects work. - Unicode text such as Hindi, Arabic or emoji is kept exactly as written.
Privacy
API responses often hold personal data or secrets. This tool never sends your text anywhere. The formatting is done by your browser, on your device, and nothing is stored or logged.