JSON Formatter
Format JSON online to make a long line of data readable. Choose two spaces, four spaces or tabs, browse a searchable tree, or minify the result for compact storage.
If formatting stops on a syntax error, use the JSON Validator to find the error location and check whether a repair is available.
- Use it when
- An API gives you JSON on one long line. Add indentation so you can read it or explore it in a tree.
- Keep in mind
- Formatting changes spacing only. Use the Validator if the JSON has a syntax error.
{"ok":true}{
"ok": true
}Your input stays in this browser. We don’t upload it. How we handle your data .
How to format JSON
Paste JSON or open a file, choose an indentation style and select Format JSON. Format JSON and Minify JSON update the same editor. Use Undo to restore the previous text, or switch to Tree to explore the document.
Frequently asked questions
What is the difference between pretty-printing and minifying JSON?
Pretty-printing adds indentation and line breaks to make JSON easier to read. Minifying removes unnecessary whitespace to make the same document smaller. Whitespace inside quoted strings stays intact.
Does formatting change the values or key order?
The formatter changes whitespace around values and punctuation. It preserves field order and the text of number values, including long numeric IDs and exponents.
How can I find a field in a large JSON file?
Open the file and switch to Tree. Search for a key or value, or expand branches to browse the document. Use Collapse all to close the branches. You can copy a field path directly from the tree.
Should I indent JSON with two spaces, four spaces or tabs?
All three are valid because indentation is for readability. Match your project’s style. Two spaces keep deeply nested data compact, while four spaces give each level more separation.