Passer au contenu principal

Convert JSON to XML online: guide and examples

How to convert JSON to XML? Mapping rules, free online tool and step-by-step transformation examples.

Published on January 11, 2026

Converting JSON to XML is necessary when integrating with legacy systems, SOAP web services, XSLT transformation pipelines or certain APIs that only accept XML format. An online tool avoids writing a conversion script manually.

Understanding the conversion

JSON and XML are two very different data serialization formats. JSON uses braces, brackets and commas. XML uses nested tags with attributes. The conversion follows mapping rules: JSON objects become XML elements, JSON arrays become repeated elements, primitive values become the text content of a tag.

📊 Conversion table

JSON structure Equivalent XML structure
{"name": "Alice"} <name>Alice</name>
{"user": {"name": "Alice"}} <user><name>Alice</name></user>
{"items": [1, 2, 3]} <items><item>1</item><item>2</item><item>3</item></items>
{"active": true} <active>true</active>
{"count": 42} <count>42</count>

💡 Practical examples

Example 1: convert a user object

JSON: {"id": 1, "name": "Alice", "email": "[email protected]"} → XML: <root><id>1</id><name>Alice</name><email>[email protected]</email></root>

Example 2: convert a product array

JSON: {"products": [{"id": 1}, {"id": 2}]} → XML: <products><product><id>1</id></product><product><id>2</id></product></products>

Example 3: SOAP integration use case

SOAP APIs require XML. Generate your payload in JSON in your code, then convert it to XML with the tool before sending it to the SOAP service.

⚡ Use the tool

Try our free online tool — no installation required.

Open the tool →

🔗 Other useful tools

Lien copié !