Tools

JSON → XML

Convert JSON data to XML format.

JSON
Ln:1 Col:1
XML

About JSON to XML Conversion

XML (eXtensible Markup Language) remains widely used in enterprise systems, SOAP web services, Android resources, Maven/Gradle build files, and legacy API integrations. Converting JSON to XML is frequently required when integrating modern REST APIs with older SOAP services, or when generating configuration files for Java frameworks, Spring Boot, or enterprise middleware.

XML vs JSON Quick Reference

XML is more verbose than JSON but offers features JSON lacks: attributes (inline metadata within tags), namespaces (for schema validation and conflict avoidance), CDATA sections (for embedding raw content), and DTD/XSD schema validation. XML documents must have a single root element, and all tags must be properly closed or self-closed.

Key conversion considerations: JSON arrays become repeated sibling elements with the same tag name. JSON keys that are not valid XML tag names (starting with numbers or containing spaces) may need sanitization. The XML declaration (<?xml version="1.0" encoding="UTF-8"?>) is added automatically for standards compliance. Special characters (&, <, >, ", ') in values are automatically escaped to their XML entity equivalents (&amp;, &lt;, &gt;, &quot;, &apos;).

Frequently Asked Questions

How are JSON arrays converted to XML?
XML has no native array concept, so each array element is repeated with the same tag name. Example: ["a","b"] → <item>a</item><item>b</item>. The wrapper element name may vary by tool.
How are XML attributes handled?
JSON has no attribute concept, so all values become child elements in JSON→XML conversion. If you need attributes, adjust manually after conversion or use a tool that supports @attr conventions.
How is null represented in XML?
XML has no null type. It is typically represented as an empty tag (<value/>), xsi:nil="true" attribute, or by omitting the tag entirely. This tool uses empty tags.