Why Convert JSON to XML?
Modern web apps and REST APIs mostly speak JSON, but plenty of systems still expect XML: older enterprise software, SOAP web services, some banking and payment integrations, government data portals, and tools that work with feeds or configuration files. When your data is in JSON and the other side wants XML, this converter bridges the gap in a single click.
How to Use the JSON to XML Converter
- Paste valid JSON into the input panel, or click Load Sample.
- Optionally change the Root Node name to match what the receiving system expects.
- Click Convert to XML.
- Copy the formatted XML from the output panel.
If the JSON has a syntax error, fix it first — our JSON Formatter will show you where the problem is.
Example
JSON input:
{
"student": {
"name": "Priya",
"class": 10,
"subjects": ["Maths", "Science"]
}
}
XML output (root node: root):
<?xml version="1.0" encoding="UTF-8"?>
<root>
<student>
<name>Priya</name>
<class>10</class>
<subjects>Maths</subjects>
<subjects>Science</subjects>
</student>
</root>
How JSON Maps to XML
| JSON | XML |
|---|---|
| Object key | Element name |
| String / number / boolean | Element text |
| Nested object | Nested elements |
| Array | Repeated elements with the same name |
| Top level | Wrapped in one root element |
Things to Watch For
- Key names: XML names can’t start with a digit or contain spaces. Rename keys like
"2024 sales"to"sales_2024"first. - Data types: XML stores everything as text, so the receiving system won’t automatically know that
10is a number. A schema (XSD) can define types if needed. - Attributes: this converter creates elements, not attributes. If the target system needs attributes (like
<item id="5">), adjust the output or the receiving code. - Empty values:
nulland empty strings become empty elements. - Special characters:
&,<,>and quotes inside values are escaped automatically, so a value like “Salt & Pepper” produces valid XML.
JSON vs XML at a Glance
| JSON | XML | |
|---|---|---|
| Size | Compact | More verbose |
| Data types | String, number, boolean, null | Text only (types via schema) |
| Attributes & namespaces | No | Yes |
| Comments | No | Yes |
| Typical use | REST APIs, web apps | Enterprise systems, feeds, documents |
Related Tools
- XML to JSON — the reverse conversion.
- XML Formatter — beautify and validate XML.
- JSON Formatter — validate JSON before converting.