JSON → XML
JSON Input
Loading editor…
XML Output
Loading editor…

JSON to XML Converter

Paste JSON into the left panel and get well-formatted XML on the right. The converter preserves nesting, handles arrays, and adds an XML declaration header. Download the result as a .xml file.

Real-time
Output updates as you type.
Nested
Preserves full object depth.
Copy
One-click copy to clipboard.
Download
Save output as a .xml file.

How JSON Maps to XML

JSON objects become XML elements, with keys as tag names and values as text content or nested elements. JSON arrays are repeated elements with the same tag name. Because XML requires a single root element, the top-level JSON object key becomes the root tag.

Example input:

{
  "user": {
    "name": "Alice",
    "roles": ["admin", "editor"],
    "active": true
  }
}

Output XML:

<?xml version="1.0" encoding="UTF-8"?>
<user>
  <name>Alice</name>
  <roles>admin</roles>
  <roles>editor</roles>
  <active>true</active>
</user>

Key rules:

  • Each JSON key becomes an XML element tag
  • Nested objects become nested elements
  • Arrays become repeated sibling elements with the same tag name
  • Booleans and numbers are written as text node content

When to Convert JSON to XML

Most modern APIs use JSON, but XML is still required in several contexts.

Banking, government, ERP, and insurance systems frequently expose SOAP services that only accept XML. Web syndication formats — RSS and Atom — are XML, so generating a feed from a JSON content collection requires conversion. Office Open XML (docx, xlsx) files are ZIP archives of XML; some document generation pipelines use JSON as the source and need XML as an intermediate step.

Android string resources, layouts, and manifests are XML. A JSON localisation file often needs converting before it can be imported into an Android project. SVG is also XML, so data-driven chart generation sometimes starts from JSON and outputs SVG via XML conversion.

XML Limitations Compared to JSON

XML is more expressive than JSON in some ways (attributes, namespaces, mixed content) but has notable limitations when converting from JSON:

JSON featureXML equivalentNotes
Object keyElement tag nameTag names cannot start with numbers or contain spaces
ArrayRepeated elementsNo explicit array marker — inferred from repeated tags
nullEmpty element or absent<field/> or omitted
BooleanText node<active>true</active>
NumberText nodeNo type information preserved
Root arrayNot supportedXML must have a single root element

Root array limitation — if your JSON is a top-level array rather than an object, you must wrap it in a root object key before converting. For example: { "items": [...] }.

Frequently Asked Questions

How does the JSON to XML converter work?

The converter parses your JSON and maps each key to an XML element tag. Nested objects become nested elements, and arrays become repeated sibling elements. The output includes an XML declaration header.

Does the converter support nested objects?

Yes. Nested JSON objects are recursively converted to nested XML elements, preserving the full depth of your data structure.

How are JSON arrays handled in XML?

JSON arrays are converted to repeated XML elements with the same tag name. For example, an array of three items under the key 'roles' becomes three <roles> elements.

Does my JSON need a single root object?

Yes. XML requires a single root element, so your top-level JSON should be an object (not an array). If you have a root array, wrap it in an object first: { "items": [...] }.

Can I convert XML back to JSON?

Yes — use the XML to JSON tool on JSONbite. It handles attributes, nested elements, repeated tags, and namespaces.

Is my data sent to a server?

No. Conversion runs entirely in your browser using the fast-xml-parser library. Your data never leaves your machine.

More Tools