JSON Formatter
Paste JSON to indent it, minify it, sort its keys or browse it as a tree. If it is not valid, you get the line and column of the first problem and a plain-English reason.
Free, no sign-up. Your JSON stays in your browser, so it is safe to paste private data.
Your JSON
Paste some JSON to format it.
How to
Format JSON in three steps
Paste your JSON
Drop it into the box. It can be a single line from an API response or a messy file.
Choose format or minify
Format adds line breaks and indentation so it is easy to read. Minify removes every unneeded space to make it small.
Browse or fix
Open and close branches in the tree, search keys and values, and copy the path to any value. If the JSON is invalid, the message gives the line and column and shows the spot.
Common JSON mistakes
- Trailing commas are not allowed. Remove the comma after the last item in an object or array.
- Keys and strings need double quotes. Single quotes and unquoted keys are valid in JavaScript but not in JSON.
- JSON has no comments, and no NaN, Infinity or undefined.
- Numbers cannot start with a zero (01) or end with a decimal point (1.).
FAQ
JSON formatter questions
Is it safe to paste private JSON here?
Yes. The formatting runs in your browser and nothing is uploaded or stored. Closing the tab clears it.
Why does my JSON show an error?
It breaks a JSON rule. The message gives the line and column of the first problem. Typical causes are a trailing comma, single quotes, an unquoted key or a missing bracket.
Does formatting change big numbers?
No. Many tools parse numbers into floating point and round long integers. This one keeps each number exactly as written.
What does sorting keys do?
It puts the keys of every object in A to Z order, which makes two files easier to compare. Arrays keep their order, because the order of array items matters.
Is there a size limit?
The box accepts up to 2,000,000 characters and nesting up to 500 levels deep. The tree view shows the first 2,000 values and says when it has cut the list; the formatted text always has everything.
What does Copy path give me?
A path such as $.items[0].name or $["first name"]. It points to one value and is useful in code or notes. It is a plain path, not a query language.