JSON to XML
POST
/v1/convert/json-to-xml
curl -X POST "https://convert.toolkitapi.io/v1/convert/json-to-xml" \
-H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"json": {"user": {"name": "Alice", "age": 30}}, "root_element": "data"}'
# See curl example
// See curl example
Response
200 OK
{
"xml": "<?xml version=\"1.0\"?>\n<data>\n <user>\n <name>Alice</name>\n <age>30</age>\n </user>\n</data>",
"size": 104
}
How to Use
1
Send a POST request to /v1/convert/json-to-xml with a json object or array and an optional root_element name.
About This Tool
Convert a JSON object or array to well-formed XML. Object keys become element names, arrays become repeated sibling elements, and primitive values become text content.
Configurable root element name (defaults to 'root'). Attributes are not generated — the output is a clean element-only structure.
Why Use This Tool
- Legacy Integration — Convert JSON API responses to XML for SOAP or legacy systems that require XML input.
- Configuration Files — Generate XML configuration from JSON data structures.
Frequently Asked Questions
Are XML attributes supported?
No — the converter produces element-only XML. JSON keys become child elements, not attributes.
How are arrays handled?
Array items become repeated sibling elements named 'item' by default.
Start using JSON to XML now
Get your free API key and make your first request in under a minute.