JSON to XML Converter

Transform your JSON objects into structured XML strings instantly. Fast, private, and developer-friendly.

JSON Input
XML Output

Why Convert JSON to XML?

Modern web apps and REST APIs mostly speak JSON, but plenty of systems still expect XML: older enterprise software, SOAP web services, some banking and payment integrations, government data portals, and tools that work with feeds or configuration files. When your data is in JSON and the other side wants XML, this converter bridges the gap in a single click.

How to Use the JSON to XML Converter

  1. Paste valid JSON into the input panel, or click Load Sample.
  2. Optionally change the Root Node name to match what the receiving system expects.
  3. Click Convert to XML.
  4. Copy the formatted XML from the output panel.

If the JSON has a syntax error, fix it first — our JSON Formatter will show you where the problem is.

Example

JSON input:

{
  "student": {
    "name": "Priya",
    "class": 10,
    "subjects": ["Maths", "Science"]
  }
}

XML output (root node: root):

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <student>
    <name>Priya</name>
    <class>10</class>
    <subjects>Maths</subjects>
    <subjects>Science</subjects>
  </student>
</root>

How JSON Maps to XML

JSONXML
Object keyElement name
String / number / booleanElement text
Nested objectNested elements
ArrayRepeated elements with the same name
Top levelWrapped in one root element

Things to Watch For

  • Key names: XML names can’t start with a digit or contain spaces. Rename keys like "2024 sales" to "sales_2024" first.
  • Data types: XML stores everything as text, so the receiving system won’t automatically know that 10 is a number. A schema (XSD) can define types if needed.
  • Attributes: this converter creates elements, not attributes. If the target system needs attributes (like <item id="5">), adjust the output or the receiving code.
  • Empty values: null and empty strings become empty elements.
  • Special characters: &, <, > and quotes inside values are escaped automatically, so a value like “Salt & Pepper” produces valid XML.

JSON vs XML at a Glance

JSONXML
SizeCompactMore verbose
Data typesString, number, boolean, nullText only (types via schema)
Attributes & namespacesNoYes
CommentsNoYes
Typical useREST APIs, web appsEnterprise systems, feeds, documents

Related Tools

Frequently Asked Questions

Each JSON key becomes an XML element containing its value. Nested objects become nested elements, and every item in an array becomes a repeated element. Everything is wrapped in a single root element.
XML must have exactly one top-level element. JSON does not have that rule, so the converter wraps the output in a root element. You can rename it (for example to "order" or "data") using the Root Node field.
Each item in the array is written as a separate element with the same name. For example, "tags": ["a", "b"] becomes <tags>a</tags><tags>b</tags>.
XML element names cannot start with a number or contain spaces. Keys like "1st" or "first name" may produce invalid XML, so rename them in the JSON (for example "first_name") before converting.
Yes. Characters such as &, <, > and quotes inside values are escaped so the resulting XML is well-formed.
No. The conversion runs entirely in your browser.