About the JSON to XML
Convert JSON objects and arrays to indented, well-formed XML. Arrays become repeated elements, and keys are sanitized into valid XML tag names.
Key features
- Converts any JSON to well-formed, indented XML
- Custom root element name
- Arrays become repeated elements
- Invalid tag names are sanitized automatically
- Special characters are escaped (&, <, >, ")
- Download as a .xml file
Why convert JSON to XML?
JSON dominates modern web APIs, but XML is still everywhere in enterprise systems: SOAP services, banking and payment integrations, government data exchanges, RSS feeds, Android resources, Microsoft Office formats and many legacy platforms. When you have JSON data and need to feed it into one of these systems, you need a reliable conversion.
Conversion rules
| JSON | XML |
|---|---|
Object {"a": 1} | <a>1</a> inside the parent |
| Nested object | Nested elements |
Array "tag": ["x","y"] | <tag>x</tag><tag>y</tag> |
String with & or < | Escaped as & / < |
null | <key/> |
true / numbers | Text content true / 42 |
| Top-level array | <root><item>…</item></root> |
Example
{
"order": {
"id": 1001,
"customer": "Ada",
"items": [
{ "sku": "A1", "qty": 2 },
{ "sku": "B7", "qty": 1 }
]
}
}
becomes
<?xml version="1.0" encoding="UTF-8"?>
<root>
<order>
<id>1001</id>
<customer>Ada</customer>
<items>
<sku>A1</sku>
<qty>2</qty>
</items>
<items>
<sku>B7</sku>
<qty>1</qty>
</items>
</order>
</root>
Common use cases
- SOAP and legacy APIs that accept only XML bodies.
- Data feeds for marketplaces, product catalogues or partners that require XML.
- Configuration for Java/Spring, .NET and Maven tools.
- Archiving data in formats that XML schemas can validate.
Tips
- Choose a meaningful root. Name the root element after your data (
orders,catalog) instead ofroot. - Pluralization. Repeated elements use the array's key. If your target schema expects
<item>children inside<items>, restructure the JSON first (e.g."items": {"item": [...]}). - Validate the input. Invalid JSON is reported with the error position. Fix it with the JSON Fixer.
Related tools
Converting to a config format? Try JSON to YAML or JSON to TOML. For tabular data, JSON to CSV is usually a better fit than XML.
How to use the JSON to XML
- Paste your data into the input box, upload a file, or click Sample to try it out.
- Adjust the options above the editor if you need to (indentation, delimiter, and so on).
- The XML appears instantly in the output panel. Any errors are shown with their line and column.
- Click Copy to copy the result, or Download to save it as a file.