JSON to XML Converter
Convert JSON to XML with the root element name you choose and an optional XML declaration. Lists become repeated elements. Nothing is uploaded.
0 characters · 2,000,000 remaining
0 characters
Paste XML or JSON above and the result appears here, converted in your browser.
On this device
No signup. Your input is never uploaded.
How to use the JSON to XML Converter
Paste your JSON, or load the example.
Set the root element name, and turn on the XML declaration if you need one.
Copy the XML, or download it as a file.
An example
A user with two roles
You enter
{"user":{"name":"Ada","age":36,"roles":["admin","editor"]}}You get
<user> <name>Ada</name> <age>36</age> <roles>admin</roles> <roles>editor</roles> </user>
How the JSON to XML Converter works
Each key in the JSON becomes an element, and each item in a list becomes a repeated element with the list's name. Keys that start with @ become attributes, so XML converted to JSON here converts back.
Limits to know about
- Up to 2 million characters of input are accepted.
- Keys have to be valid XML names: a letter or underscore first, and no spaces.
- JSON has no comments or processing instructions, so the XML has none either.
Questions about the JSON to XML Converter
Paste the JSON and the XML appears as you type. Each key becomes an element with its value inside.
Each item in a list becomes its own element with the list's name, so roles with two values becomes two roles elements, one after the other.
An XML document has exactly one element around everything else. When the JSON has a single key at the top, that key becomes it. Otherwise everything is wrapped in an element called root, or the name you choose.
Start the key with @, such as "@id": 7, and it is written as an attribute of its element. A #text key becomes the element's own text.
Last updated