JSON to XML converts a JSON object into well-formed XML. Each JSON key becomes an XML element, arrays become repeated elements, and keys prefixed with @ become XML attributes.
The converter produces a complete XML document with an XML declaration. You can customize the root element name, enable pretty-printing with indentation, and use the #text key convention for mixed content elements.
This is useful for integrating with SOAP services, generating XML configs from JSON data, or converting modern JSON APIs into XML format for legacy systems. All conversion happens in your browser.
{ "user": { "@id": 42, "@role": "admin", "name": "Alice", "email": "alice@example.com" }
} // Converts to:
<user id="42" role="admin"> <name>Alice</name> <email>alice@example.com</email>
</user>{ "items": { "item": ["Apple", "Banana", "Cherry"] }
} // Converts to:
<items> <item>Apple</item> <item>Banana</item> <item>Cherry</item>
</items>If your JSON has a single top-level key, it becomes the root element automatically. With multiple top-level keys, a wrapping <root> element is added (customizable via the Root Element input).
Arrays use the key name for each repeated element. "items": [1, 2, 3] produces <items>1</items><items>2</items><items>3</items>. For singular element names, structure your JSON with a wrapper object.
XML special characters (& < > " ') in values and attributes are automatically escaped. JSON keys used as element names should be valid XML names (no spaces or special characters).
Paste your JSON object into the input panel and click "Convert to XML". Keys become elements, @-prefixed keys become attributes, and arrays become repeated elements.
Yes. Type the desired root element name in the "Root element" input. If left empty and your JSON has a single top-level key, that key is used as the root automatically.
Null values produce self-closing XML elements: <fieldName/>.
You can include namespace attributes using the @xmlns convention, e.g., "@xmlns": "http://example.com".
Yes. All processing happens in your browser. Nothing is sent to any server.