JSON to XML Converter
Paste JSON, get well-formed XML as you type
Input JSON
Output XML
What this converter does
Plenty of systems still want XML: SOAP services, payment gateways, older ERPs. If your data is JSON, paste it on the left and the XML appears on the right. Every object becomes an element, every key becomes a child element, and the whole thing is wrapped in a single root element so the result is always one well-formed document.
JSON and XML do not map one to one, so here are the rules. Arrays become repeated elements named after their key ("item": [..] gives several <item> elements), and a top-level array is wrapped as <root><item>…. Keys starting with @ become attributes and #text becomes the element's text, the same convention our XML to JSON tool produces. Keys that are not legal XML names are fixed up: first name becomes first_name and 2fa becomes _2fa.
XML has no types, so numbers, booleans and strings all end up as text, null and empty objects become empty elements, and an empty array becomes an empty element too. Long integer IDs such as 8901240544102066246 are copied digit for digit instead of being rounded the way JSON.parse would. The conversion runs in your browser; nothing is uploaded.
How to Use JSON to XML
Follow these steps to convert JSON to XML. Each step uses the actual buttons and panels on this page.
Paste, Upload, or Load Sample
Paste JSON into the left Input JSON panel, or click Upload to load a .json file. Sample loads a small subscriber list. If the JSON is invalid, the parser's message appears above the output panel.
Configure Settings (Optional)
Click the Settings (gear) button to rename the Root Element (default root; invalid names are fixed up the same way keys are) and to turn the XML Declaration line on or off. The Output XML panel updates as you type.
Download or Copy
Click Download to save converted.xml, or Copy to put it on your clipboard. Run it through the XML Validator if you want a second check.
When you'd actually use this
API Integration
Feeding a SOAP or XML-only API from a service that speaks JSON. Convert a sample payload, compare it with what the API expects, then adjust key names until they match.
Data Migration
Migrate JSON data to XML-based systems. Convert data formats when moving between systems or integrating with enterprise applications.
Format Compatibility
Some systems require XML format. Convert your JSON data to XML when working with tools or systems that only accept XML.
Enterprise Integration
Many enterprise systems use XML. Convert JSON to XML when integrating with legacy systems, SOAP services, or enterprise applications.
Common Questions
Is my JSON uploaded?
No. Parsing and conversion happen in your browser. Inputs over 2 MB are refused to keep the page responsive.
How do I get XML attributes?
Prefix the key with @. {"price": {"@currency": "USD", "#text": 24.99}} becomes <price currency="USD">24.99</price>. An @attributes object works too, which is the shape our XML to JSON converter gives you.
How are arrays handled?
An array becomes one element per entry, all with the key's name. A top-level array is wrapped in the root element with each entry as <item>, because an XML document can only have one root. An array inside an array is also wrapped in <item> elements.
Are data types preserved?
Only as text. XML has no number or boolean type, so 45.2, true and "45.2" all come out the same. null, {} and [] become empty elements. If you need the types back on the other side, describe them with an XML Schema.
What happens to keys that are not valid XML names?
Characters XML does not allow in names (spaces, colons, symbols) are replaced with _, and a name that starts with a digit or punctuation gets a leading _. So "first name" becomes <first_name> and "2fa" becomes <_2fa>.
What about special characters in values?
&, < and > are escaped in text, and quotes are escaped inside attributes. Control characters that XML 1.0 forbids entirely are replaced with the U+FFFD replacement character.
Other JSON Tools You Might Need
Conversion is just one JSON task. Here are other tools that work well together: