Use JSON to XML Converter

Enter your data below to use the JSON to XML Converter

📌 Try these examples:
RESULT

Last updated

Example: Nested Objects

// Input JSON:
{
  "user": {
    "id": 1,
    "name": "Alice",
    "address": {
      "city": "New York",
      "zip": "10001",
      "country": "US"
    }
  }
}

// Output XML:
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <user>
    <id>1</id>
    <name>Alice</name>
    <address>
      <city>New York</city>
      <zip>10001</zip>
      <country>US</country>
    </address>
  </user>
</root>

Example: Arrays

// Input JSON:
{
  "users": [
    { "id": 1, "name": "Alice" },
    { "id": 2, "name": "Bob" },
    { "id": 3, "name": "Carol" }
  ]
}

// Output XML (array items use parent element name):
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <users>
    <user>
      <id>1</id>
      <name>Alice</name>
    </user>
    <user>
      <id>2</id>
      <name>Bob</name>
    </user>
    <user>
      <id>3</id>
      <name>Carol</name>
    </user>
  </users>
</root>

Example: Special Characters (XML Entities)

// Input JSON:
{
  "title": "AT&T Annual Report",
  "description": "Revenue > $100B",
  "code": "<script>alert('xss')</script>",
  "quote": "He said \"hello\""
}

// Output XML (special characters escaped):
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <title>AT&T Annual Report</title>
  <description>Revenue > $100B</description>
  &lt;script&gt;alert('xss')&lt;/script&gt;
  <quote>He said "hello"</quote>
</root>

// XML entity reference:
// & → &
// <  → <
// >  → >
// " → "
// ' → '

Example: Null Values

// Input JSON:
{
  "name": "Alice",
  "middleName": null,
  "age": 30
}

// Output XML (null as empty element):
<root>
  <name>Alice</name>
  <middleName/>
  <age>30</age>
</root>

// Or with xsi:nil attribute:
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <name>Alice</name>
  <middleName xsi:nil="true"/>
  <age>30</age>
</root>

Example: JSON Properties as XML Attributes

// Input JSON:
{
  "product": {
    "id": "P001",
    "name": "Widget",
    "price": 9.99,
    "currency": "USD"
  }
}

// Output XML (id and currency as attributes):
<root>
  <product id="P001" currency="USD">
    <name>Widget</name>
    <price>9.99</price>
  </product>
</root>

Example: With XML Namespace

// Input JSON:
{
  "order": {
    "id": "ORD-001",
    "customer": "Alice",
    "total": 45.00
  }
}

// Output XML (with namespace):
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns="https://example.com/orders/v1"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <order>
    <id>ORD-001</id>
    <customer>Alice</customer>
    <total>45.00</total>
  </order>
</root>

Example: SOAP Request Body

// Input JSON (API request body):
{
  "GetUserRequest": {
    "userId": 42,
    "includeProfile": true
  }
}

// Output XML (for SOAP body):
<GetUserRequest>
  <userId>42</userId>
  <includeProfile>true</includeProfile>
</GetUserRequest>

JSON to XML Type Mapping

JSON Type     XML Representation
──────────────────────────────────────────────────
string        Text content: <name>Alice</name>
number        Text content: <age>30</age>
boolean       Text content: <active>true</active>
null          Empty element: <field/> or xsi:nil="true"
object        Nested elements
array         Repeated elements with parent name

Paste your JSON to convert it to well-formed XML. Configure namespace declarations, attribute mapping, and null handling to match the requirements of your target XML-based system.

Example: Simple Object

// Input JSON:
{
  "name": "Alice Smith",
  "age": 30,
  "email": "alice@example.com",
  "active": true
}

// Output XML:
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <name>Alice Smith</name>
  <age>30</age>
  <email>alice@example.com</email>
  <active>true</active>
</root>

Frequently Asked Questions

Simply enter your data, click the process button, and get instant results. All processing happens in your browser for maximum privacy and security.

Yes! JSON to XML Converter is completely free to use with no registration required. All processing is done client-side in your browser.

Absolutely! All processing happens locally in your browser. Your data never leaves your device, ensuring complete privacy and security.