JSON to XML Converter
Convert JSON to XML format instantly. Paste or upload your JSON file.
Upload a JSON or TXT file (max 5MB)
Conversion Options
How to Use:
- Paste your JSON content in the left textarea or upload a JSON file
- Customize conversion options (root element name, array item name, etc.)
- Click "Convert to XML" to transform your JSON
- Copy the XML output or download it as a file
- Use "Format XML" or "Minify XML" to adjust the output
How This JSON-to-XML Mapping Actually Works
JSON and XML don't map onto each other cleanly, because JSON has no concept of an attribute โ every value is either a key/value pair, an array entry, or a scalar. This converter resolves that mismatch by turning every object key into a child element rather than an attribute, so {"user": {"id": "42"}} becomes <user><id>42</id></user>, never <user id="42">. If your target schema expects attributes (a common requirement in SOAP/WSDL contracts), you'll need a post-processing step or a different tool.
JSON keys also don't follow XML naming rules โ XML element names can't start with a digit and can't contain spaces or most punctuation. This converter strips leading digits and replaces disallowed characters with an underscore automatically, so a key like "2nd place" becomes the element <nd_place>. That's a lossy, one-way transformation: converting the resulting XML back to JSON will not restore your original key names.
A Quirk Worth Knowing: Array Item Naming
The Array Item Name option only takes effect when the JSON you paste is itself a top-level array (e.g. ["a","b","c"]). When an array is the value of an object key โ the far more common case, e.g. {"tags":["red","blue"]} โ each item is instead wrapped in a repeated element named after that key, producing <tags>red</tags><tags>blue</tags> rather than a generic <item> wrapper. If you're expecting a fixed "item" tag around every array element regardless of where the array sits, check your output โ you may need to adjust the JSON shape before converting, or restructure the XML afterward.
null values become self-closing tags (<field/>) rather than being dropped, so a round trip through this converter preserves the fact that a key existed with no value โ useful if the receiving system distinguishes "absent" from "null." Strings are escaped for the five XML special characters (& < > " ') automatically, so JSON values containing raw ampersands or angle brackets won't break the output.
When You Actually Need This
The realistic reasons to go from JSON to XML are narrower than they used to be: talking to a SOAP or WS-* endpoint that still expects an XML envelope, feeding a legacy ETL pipeline or EDI-adjacent system built around XML schemas (XSD) rather than JSON Schema, generating config files for tools (Ant, MSBuild, some CI systems) that only read XML, or producing an XML payload for a partner API that validates against a fixed schema. In each of these, check whether the receiving system needs attributes โ if it does, this element-only mapping won't satisfy validation and you'll need to hand-adjust the output.
Frequently Asked Questions
Why isn't my JSON key showing up as an XML attribute?
This converter always represents JSON keys as child elements, never as attributes โ JSON has no native attribute concept to map from, so there's no reliable rule for deciding which keys "should" become attributes instead of elements.
My object key had a space or started with a number โ what happened to it?
It was sanitized: leading digits are stripped and invalid characters become underscores, because XML element names can't start with a digit or contain spaces. Check the output element names against your schema before using them downstream.
Can this validate my XML against an XSD schema?
No โ it converts structure only. If your target system enforces a schema, validate the generated XML against it separately before submitting.
Why does "Format XML" sometimes indent differently than I expect?
The formatter walks the tag stream character-by-character to infer opening vs. closing tags; unusual constructs like inline comments or processing instructions in hand-edited XML can occasionally throw off the indent depth. Re-running "Minify XML" then "Format XML" resets it cleanly.
Is there a limit on JSON nesting depth?
Conversion is recursive with no artificial depth cap, but deeply nested JSON (hundreds of levels) will produce equally deep XML and can slow down the browser tab formatting it โ flatten unusually deep structures first if you hit this.
