How to use the formatter
- Paste your data into the left editor, drop a file onto it, or click Upload. The JSON/XML switch changes by itself when the text starts with
{,[or<. - Click Format or press
Ctrl+Enter. The editor is re-indented and the right panel shows a tree you can open and close. - If something is wrong, the status bar tells you the line and column, and that line turns red in the editor.
- Use Copy or Download above the right panel to take the result with you.
What each button does
| Button | What it does |
|---|---|
| Format | Checks the syntax and re-indents everything. Pick 2 spaces, 4 spaces or tabs in the Indent menu; the choice is remembered next time. |
| Minify | Removes every space and line break that isn't part of a value, so the whole document fits on one line. The status bar shows how many bytes you saved. |
| Repair | Fixes JSON that won't parse because of unquoted keys, a trailing comma, // comments or a missing closing bracket. |
| Sort JSON / Sort XML | Puts keys (or elements) in alphabetical order. Handy when you want to compare two versions of the same response. |
| Convert to … | Produces XML, JSON, YAML, TOML, CSV or SQL. The result shows on the right and your original stays untouched on the left. |
| Share | Uploads the text and gives you a temporary link. Tick "one-time link" and it is deleted after the first person opens it. |
Reading an error message
Say you paste this:
{
"id": 7,
"tags": ["api", "v2",],
}
The status bar will read Invalid JSON — line 3, column 23: Trailing comma is not allowed before ']'. Column 23 is the comma itself, so you can go straight to it. The messages name the actual mistake, such as a missing comma between two properties, a key without quotes, or a string that never ends, instead of a bare "unexpected token".
Your numbers stay exactly as you typed them
Many online formatters run JSON through JavaScript's JSON.parse and print it back out. That quietly changes data: 12345678901234567890 turns into 12345678901234567000, 1.0 turns into 1, and a key that appears twice loses one of its values. This formatter reads the text itself, so large IDs, decimal places, escape sequences like \u00e9 and repeated keys come out the way they went in. Only the whitespace changes.
JSON or XML?
Both describe nested data, but they do it differently:
- JSON has real lists (
[1, 2, 3]). XML shows a list by repeating an element:<item>,<item>,<item>. - JSON values have types: numbers,
true/falseandnull. In XML everything is text unless a schema says otherwise. - XML has attributes (
id="7"), comments and namespaces. JSON has none of these.
Most web APIs today send JSON. XML is still common in SOAP services, RSS and Atom feeds, Maven pom.xml files, Android layouts and a lot of banking and government systems.
What happens to your data
Formatting, minifying, validation, the tree view and folding run in your browser. For those, your text isn't sent anywhere. Repair, Sort and the Convert buttons send the editor content to our server, which does the work and sends the result back. Share keeps the text on the server for a short time so the link works. The privacy page has the details.
Keyboard shortcuts
Ctrl+Enter: formatTab: indent by two spaces instead of leaving the editorCtrl+A: select everything, including folded blocksEsc: leave full-screen mode
Frequently asked questions
Is this JSON formatter free?
Yes. There is no account and no sign-up. To keep the service fast for everyone, very rapid repeated use of the convert and repair buttons is briefly rate-limited.
How large a file can I format?
Files of several megabytes work. Above about 20,000 lines the editor switches off code folding to stay responsive, and the tree view opens only the first two levels until you expand more.
Why do I get "Property names must be wrapped in double quotes"?
JSON only accepts double-quoted keys. {name: "x"} and {'name': "x"} are fine in JavaScript but not in JSON. Click Repair to add the missing quotes, or write {"name": "x"}.
Can I format JSON that is stored inside a string?
Yes. If the whole input is a JSON string that itself contains JSON, which is common in log files and message queues, Format unwraps it and shows the inner document.
Does it work on a phone?
Yes. On small screens the editor and the viewer stack on top of each other, and each one scrolls on its own.