JSON to XML Converter
Turn JSON into well-formed XML for a SOAP service, a feed or an older system that only reads XML.
Convert JSON to XML Online
Plenty of systems still speak XML: SOAP web services, RSS and Atom feeds, payment and banking interfaces, and many enterprise imports. When your data is JSON, it has to be turned into elements and attributes first. This page is the JSON Converter with JSON in and XML out.
Conversion happens in the page; nothing is sent to a server.
The mapping
| JSON | XML |
|---|---|
{"title": "X"} | <title>X</title> |
{"@id": "b1"} | The attribute id="b1" |
{"#text": "hi"} | The element text hi |
{"tag": ["a", "b"]} | <tag>a</tag><tag>b</tag> |
null | An empty element |
This is the same convention XML to JSON uses, so a document can go from XML to JSON and back again.
The root element
An XML document has exactly one root. If your JSON is an object with a single key, such as {"catalog": {...} }, that key becomes the root. Otherwise the whole value is wrapped in an element named by the Root element field, root by default.
Before you send it
- Check the element names the receiving system expects; JSON keys become element names as they are, apart from invalid characters.
- Numbers and booleans are written as text, because XML has no types of its own; a schema on the other side decides how they are read.
- Order follows the order of keys in your JSON, which matters for services validated against an XSD sequence.
Escaping
The characters <, > and & in values are escaped, and quotes are escaped inside attributes, so the output is always well-formed XML that any parser accepts.