How to use
- Paste your JSON into the Input box on the left, or click "Load example" to try it out.
- Click "Format" to pretty-print it with 2 or 4 spaces of indentation, or "Minify" to remove all whitespace and put it on one line.
- Use "Copy" or "Download" above the Result box to get the output.
Example
Minified JSON:
{"id":9007199254740993,"name":"Mike","tags":["vip","newsletter"]}
After formatting with 2 spaces:
{
"id": 9007199254740993,
"name": "Mike",
"tags": [
"vip",
"newsletter"
]
}
What makes this formatter different
- No loss of number precision: many online tools use JavaScript's
JSON.parse, which silently changes integers larger than 9007199254740991. For example,9007199254740993becomes9007199254740992. Here every number is kept exactly as written, and100.50does not turn into100.5. - Errors show their location: syntax errors report the line, the column and the reason.
- Your content is preserved: key order and string escapes such as
\u4e2dare left untouched. - Nothing is uploaded: everything runs in your browser.
Repair, tree view and the editor
- Repair: "Repair" adds missing commas and closing brackets, removes extra commas and comments, quotes keys and turns single quotes into double quotes. Changes are highlighted in green and listed in the message; press Cmd/Ctrl+Z to undo. Errors that would need guessing, such as a bracket missing in the middle, are not changed: the position is marked so you can fix it by hand.
- Tree view: switch the result to "Tree" to expand and collapse nodes, search keys or values, and copy a node's JSON path (such as
$.order.items[0].sku) or value. - Editor: line numbers and syntax colors; with "Wrap lines" on, long lines wrap. "Go to error" next to an error message puts the cursor on the exact character.
FAQ
Why do I get "Invalid JSON"?
The most common causes are:
- A trailing comma after the last item, e.g.
{"a": 1,} - Single quotes, e.g.
{'a': 1}; JSON only allows double quotes - Unquoted keys, e.g.
{a: 1} - Comments; standard JSON does not support
//or/* */
The error message points to a line and column. Looking at and just before that position usually reveals the problem.
What is the difference between formatting and minifying?
The data is identical; only whitespace and line breaks differ. Formatted JSON is easier to read and compare. Minified JSON is smaller, which suits config files, URL parameters and API requests.
Is my data uploaded?
No. Formatting and minifying run in your browser and nothing is sent to the server. Your input is remembered only in your own browser, is removed automatically after 30 days without use, and is cleared immediately when you click "Clear".