Skip to content

JSON to XML Converter

Convert JSON into well-formed XML with attributes, repeated elements and proper escaping.

JSON input

Tab inserts indentation. Press Escape, then Tab, to move focus out of the editor.

XML output

How to convert JSON to XML

  1. Paste JSON on the left, or open or drop a .json file.
  2. The XML appears on the right as you type.
  3. Set the root element name, indentation and whether to include an XML declaration.
  4. Copy the XML or download it as an .xml file.

How JSON maps to XML

  • Object keys become elements; nested objects become nested elements.
  • Keys starting with @ become attributes, and #text becomes the element's text.
  • Arrays become repeated elements named after their key.
  • null becomes an empty element, and &, < and > are escaped.
JSON
{"book": {"@id": "7", "title": "XML & You", "tags": ["a", "b"]}}
XML
<book id="7">
  <title>XML &amp; You</title>
  <tags>a</tags>
  <tags>b</tags>
</book>

Use cases

  • Send data from a JSON-based app to a SOAP service or legacy XML API.
  • Create XML product feeds or config files from JSON data.
  • Generate XML test fixtures from existing JSON.

Related JSON and XML tools

Convert back with XML to JSON. Check the input with the JSON validator or format it with the JSON formatter; adjust the result with the XML formatter or verify it with the XML validator.

Frequently asked questions

How do I create XML attributes from JSON?
Prefix the key with @. For example {"book": {"@id": "1", "title": "XML"}} becomes <book id="1"><title>XML</title></book>. Use #text for an element's text next to attributes.
What happens to JSON arrays?
Each array item becomes a repeated element with the array's key as its name. A top-level array is wrapped in a root element with one <item> per entry.
What if a JSON key isn't a valid XML name?
XML names can't contain spaces or start with a digit. Such keys are converted automatically — “first name” becomes first_name — and the tool lists what was renamed.
Are special characters escaped?
Yes. &, < and > in text and quotes in attributes are escaped, so the result is always well-formed XML.