JSON to XML Converter
Convert JSON to well-formed XML with a configurable root element, attributes via "@_" keys, repeated elements for arrays and optional XML declaration. Free.
Runs entirely in your browser. Your data is never uploaded.
Related Tools
View AllWhat is JSON to XML?
Convert a JSON document into XML. Objects become nested elements, arrays become repeated elements with the same name, keys starting with the attribute prefix (default @_) become XML attributes and #text becomes element text.
How to use JSON to XML
- Paste JSON into the JSON input box, or use Load sample or Open file.
- Set Root element (clear it if your JSON already has a single top-level key), Array item element for top-level arrays and Attribute key prefix.
- Choose Indentation and whether to Add XML declaration.
- The XML output updates as you type; use Copy or Download.
Example
{"@_id":"7","name":"Ada","tags":["a","b"]} <?xml version="1.0" encoding="UTF-8"?> <root id="7"> <name>Ada</name> <tags>a</tags> <tags>b</tags> </root>
When to use JSON to XML
Use it to feed JSON data to XML-only systems such as SOAP services, RSS-like feeds or legacy integrations. XML has no native types, so numbers and booleans become plain text; if the receiving system expects a specific XSD, check element order and names against it.
How JSON to XML works
The JSON is parsed and every key is sanitized into a valid XML name (invalid characters become _, names starting with a digit get a leading _). The object is then serialized with fast-xml-parser's XMLBuilder: special characters are escaped (& → &), null values become empty elements (<note/>), an array value repeats the element once per item and a top-level array is wrapped as <root><item>…</item></root>.
Common Use Cases
- Send JSON data to a SOAP or XML-RPC endpoint
- Create XML test fixtures from JSON samples
- Convert configuration exported as JSON into XML
- Produce XML for tools that only import XML
FAQs
How do I create XML attributes?
Prefix the key with the attribute prefix, by default @_: {"@_id": "7"} becomes id="7" on the parent element. Change the prefix if your JSON uses @ or $.
What happens to arrays?
"tags": ["a","b"] produces two <tags> elements. A top-level array is wrapped in the root element with one <item> per entry (configurable).
Can I omit the root wrapper?
Yes – clear Root element. The JSON must then be an object with exactly one key, which becomes the root.