JSON to XML converter

free

Convert any JSON value to XML with custom root tag and namespaced elements.

JSON
385 chars · 385 BValid
XML
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <id>550e8400-e29b-41d4-a716-446655440000</id>
  <name>Ada Lovelace</name>
  <email>ada@example.com</email>
  <age>36</age>
  <bio nil="true"/>
  <address>
    <street>21 Dorset Street</street>
    <city>London</city>
    <country>UK</country>
    <postalCode>W1U 7AA</postalCode>
  </address>
  <tags>
    <item>mathematician</item>
    <item>writer</item>
    <item>engineer</item>
  </tags>
  <createdAt>2024-01-15T09:00:00Z</createdAt>
  <verified>true</verified>
</root>
522 chars · 522 B

Convert any JSON value to XML with custom root and array-item tags. Element names that start with a digit or special character get prefixed with `_` to stay XML-spec-valid; null values emit `<tag nil="true"/>`; arrays expand to repeated sibling elements. Useful when interfacing with legacy systems, SOAP services, or RSS / Atom generators that need XML on the wire.

Common use cases

  • Driving legacy SOAP / WSDL endpoints. Many enterprise integrations still expect XML payloads. Convert your JSON request shape once, use the result as a template for hand-tuning XML namespaces.
  • Generating RSS / Atom feeds. If you already model feed items as JSON internally, convert to XML for the final serialization. Customize the root and item tags to match RSS conventions (`channel` / `item`).
  • Sitemap generation. Use `urlset` as the root tag and `url` as the item tag to produce sitemap.xml-shaped output that you can then tag with the `xmlns` attribute by hand.
  • Translating between API formats. When a backend returns JSON but a downstream consumer expects XML (or vice versa for debugging), this tool gives you a 1:1 starting point.

Frequently asked

Why do some tags start with `_`?

XML element names must start with a letter or underscore, never a digit or special character. Keys like `1st` become `_1st` so the output stays well-formed.

How are JSON arrays represented?

Each array item becomes its own element with the tag name you set ('Item tag' option, default `item`). So `tags: ["a", "b"]` becomes `<tags><item>a</item><item>b</item></tags>`.

What does `<tag nil="true"/>` mean?

How JSON `null` is conveyed in XML — the element exists but explicitly carries a `nil="true"` attribute. Mirrors the convention used by `xsi:nil`. Strip the attribute if your consumer prefers absence.

Can I emit XML attributes instead of nested elements?

Not currently — every JSON property becomes a child element. JSON has no notion of attribute-vs-content distinction, so any mapping has to be opinionated. A future option may surface this for specific keys.

Is the output XML 1.0 or 1.1?

The declaration uses `version="1.0"` (the safe default — XML 1.1 added support for additional control characters that almost no parser supports).

Should I include the XML declaration?

Include it when the output is a standalone document. Strip it when embedding the XML inside a larger document (the declaration is only valid at the top).