JSON to XML converter.
Paste JSON on the left, get pretty-printed XML on the right. Free, instant, and private — the conversion runs entirely in your browser, so nothing is uploaded anywhere.
Attribute trick: keys starting with @ become XML attributes and #text becomes text content — so {"server": {"@port": "8080"}} produces <server port="8080"/>. Round-trips with our XML to JSON converter.
Going the other way? XML to JSON converter → · All free tools →
Convert JSON to XML faster without the browser
If you convert JSON more than once a week, the copy–find-a-tab–paste loop is the slow part. The jsonbolt desktop app removes it: a global hotkey opens whatever JSON is on your clipboard, and XML export — formatted or minified — is two clicks away. It parses files at 3 GB/s, so this works on multi-gigabyte documents that would kill a browser tab.
Copy JSON anywhere
A terminal, an API client, a log file, a browser tab — if it's on your clipboard, it's ready.
Press Win + J⌃ ⌥ J
jsonbolt launches and opens your clipboard in one step — even a 1 GB payload renders instantly. (Opt-in: Settings → Launch.)
Export as XML
File → Export Selection Value As → Formatted XML writes a file; Copy Selection Value As puts it straight back on the clipboard. Select any subtree to convert just that branch.
Free for personal use — no signup. YAML, CSV, and XML export are built in.
How JSON maps to XML
| JSON | XML |
|---|---|
| Object key | An element named after the key |
| Array | The element repeated once per item |
| String / number / boolean | Text content, XML-escaped |
null, empty object, empty array | A self-closing element <key/> |
"@key" keys | Attributes on the parent element |
"#text" key | The element's text content |
| Single-key root object | That key becomes the root element; otherwise <root> wraps the document |
There's no single standard for this mapping — every library invents its own. This page uses the convention that survives a round-trip: convert XML to JSON with the reverse tool, edit it, convert back, and attributes and text land where they started.
How this converter handles the details
- It validates the JSON first — syntax errors show the parser message with the exact position.
- Output is pretty-printed with two-space indentation and an
<?xml version="1.0"?>declaration. Need it minified? The desktop app exports Minified XML too. - Text is escaped, never mangled:
&,<, and>become entities; attribute values also escape quotes. - Invalid element names are repaired, not dropped: characters XML forbids in names become underscores, and names starting with a digit get a leading underscore.
- Everything runs locally. Your data never leaves the tab.
FAQ
How do I convert JSON to XML?
Paste your JSON into the input pane at the top of this page. The XML equivalent appears instantly in the output pane — copy it to your clipboard or download it as a .xml file. The conversion runs locally in your browser.
How does JSON map to XML elements?
Object keys become element names, scalar values become text content, and arrays become repeated elements: {"port": [8080, 9090]} produces <port>8080</port><port>9090</port>. A single-key root object supplies the root element; anything else is wrapped in <root>.
Can I produce XML attributes from JSON?
Yes. Keys starting with @ become attributes on the parent element, and a "#text" key becomes its text content — the same convention our XML to JSON converter emits, so the two round-trip.
What happens to JSON keys that aren't valid XML names?
Characters that can't appear in an XML element name are replaced with underscores, and names that start with a digit get a leading underscore — "2fast" becomes <_2fast>. Everything else is escaped, never dropped.
Is my JSON uploaded to a server?
No. The converter is a small script that runs entirely in your browser. Your data never leaves your machine.
How do I convert a very large JSON file to XML?
Browser converters hold the whole document in tab memory, which gets painful past a few hundred megabytes. The jsonbolt desktop app parses the file at 3 GB/s — open the file (or press Win + J⌃ ⌥ J for clipboard JSON), select any subtree, then File → Export Selection Value As → Formatted or Minified XML.