JSON to XML converter
Paste JSON, such as an API response or a config file, and see it as XML below, as you type, ready to copy or download.
Elements, attributes and text
Each key becomes an element holding its value. Keys starting with @ ("@id") become attributes of their element and "#text" its text: the convention XML to JSON converters use, so XML converted to JSON and back comes out as it was.
Lists
A list repeats its element: "item": [1, 2] becomes two <item> elements. A list inside a list becomes an element of <item>s, so nothing is flattened.
One root element
XML has exactly one root. JSON with a single key at the top, such as {"order": {…}}, uses that key as the root; anything else, a list or several keys, goes inside <root>. The <?xml version="1.0" encoding="UTF-8"?> declaration comes first.
Names and values
Keys XML doesn't allow as names get an underscore: "a b" becomes <a_b> and "1st" becomes <_1st>. Text is escaped (&, <), null and empty strings become empty elements, and numbers, true and false are written as text, since XML has no types of its own.
Copy, download or keep editing
The XML follows your typing, and a mistake in what you paste is pointed out first, with its line and column. Copy or Download take the XML as it is; Use as text puts it in the editor in place of what you pasted (Ctrl+Z goes back).
Private: nothing is uploaded
Formatting, checking and comparing all happen in your browser. Your documents are saved in the browser's own storage on this computer, not on a server, so they never leave your device.
With your permission, we count anonymous visits (which pages and tools are used), never what you type. See Privacy.
Questions
How do I convert JSON to XML?
Paste or open the JSON: the XML appears below it as you type. YAML, TOML and Protocol Buffers text convert to XML too, from Convert to above the editor.
How do I make an attribute?
Start its key with @: {"book": {"@id": "1", "title": "XML"}} becomes <book id="1"><title>XML</title></book>.
Can I convert the XML back to JSON?
Yes, with the XML to JSON converter. Numbers and true / false come back as text, since XML holds only text.
Is my data uploaded anywhere?
Your documents aren't: everything runs in your browser, and they are saved on your computer, in the browser's storage for this site. With your permission we count anonymous visits, never their content.
More tools
- Formatter & Converter for JSON, YAML, XML, SQL
- XML to JSON Converter
- JSON to YAML Converter
- YAML to JSON Converter
- JSON to TOML Converter
- TOML to JSON Converter
- CSV to JSON Converter
- JSON to CSV Converter
- JSON Schema Generator from JSON, YAML or CSV
- Free Online Diagram Maker & Editor
- Crypto Tools: Passwords, Keys, Hashes & JWTs
- Timestamp, Cron, Regex & UUID Utilities