How to format JSON
- Paste your JSON, drop a
.jsonfile on the input, or use Open file. - Pick the indentation: 2 spaces, 4 spaces or tabs.
- Press Format. Tick Sort keys to order every object alphabetically.
- Copy the result or download it as a
.jsonfile.
Tree view for large files
The Tree tab shows objects and arrays as collapsible nodes with item counts, so you can open only the branch you care about. Large arrays are rendered in chunks to keep the page responsive.
If the JSON won't format
Formatting needs valid JSON. If yours has trailing commas, single quotes, comments or Python values, press Quick Fix first; it repairs the syntax and formats the result in one step.
Frequently asked questions
Is 2 or 4 spaces better for JSON?
Both are valid. Two spaces is the most common choice for web APIs and package.json files; four spaces or tabs can be easier to read for deeply nested data.
Does sorting keys change my data?
No. Object key order has no meaning in JSON, so sorting only changes the presentation. Array order is never changed.
How large a file can it format?
Files of several megabytes format in well under a second on a typical laptop, because everything runs locally in your browser.