Skip to content
POST /api/v1/json-to-xml

JSON to XML Converter

Paste a JSON object to convert it into well-formed XML. Supports custom root elements, attribute conversion (keys starting with @), array wrapping, and special character escaping. Works with any valid JSON object.

string required
advanced options
string

Name of the XML root element

boolean
boolean

Include <?xml version="1.0"?> header

X-Sandbox-Remaining: - get an api key

returns

data.xml
The generated XML document.
data.root_element
Name of the root element used.
data.element_count
Number of elements written.
response awaiting request sending
Fill in the fields and send a request. The response lands here.

Run it from your code

A temporary key takes one request and lasts seven days at 20 calls a day. Register and it becomes 75 a day, still free.

$ curl -sX POST "https://apixies.io/api/v1/json-to-xml" \
    -H "X-API-Key: $APIXIES_KEY" \
    -H "Content-Type: application/json" \
    -d '{"json":"..."}' | jq '.data.xml'

questions

How are JSON arrays converted to XML?

Each array item is wrapped in an element named after the parent key (singularized). For example, "books": [{...}, {...}] becomes <book>...</book><book>...</book>.

Can I control the root element name?

Yes. If your JSON has a single top-level key, that key is used as the root element automatically. Otherwise, use the root_element parameter to specify a custom name.

How do I add XML attributes?

Prefix JSON keys with @ to convert them to XML attributes. For example, {"@id": "1", "name": "test"} becomes <root id="1"><name>test</name></root>.

cookies

We use analytics cookies to see how the site gets used. Nothing loads until you accept. Privacy policy