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

JSON to XML Converter

Convert a JSON object to well-formed XML

Parameters

name in type required description
json body json required JSON Content
root_element body string optional Name of the XML root element default root
pretty body boolean optional Pretty Print
xml_declaration body boolean optional Include <?xml version="1.0"?> header

Request

Send your key in the X-API-Key header. More languages and patterns live on the code examples page.

curl -s -X POST "https://apixies.io/api/v1/json-to-xml" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"json":{"catalog":{"book":[{"title":"PHP Handbook","author":"Jane Smith","price":"29.99"},{"title":"JavaScript Guide","author":"John Doe","price":"24.99"}]}}}'

Response

The result sits under data in the standard envelope. See the response format guide for errors and status codes.

returns

data.xml
The generated XML document.
data.root_element
Name of the root element used.
data.element_count
Number of elements written.
example response 200
{
    "status": "success",
    "http_code": 200,
    "code": "SUCCESS",
    "message": "JSON converted to XML successfully",
    "data": {
        "xml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<catalog>\n  <book>\n    <title>PHP Handbook</title>\n    <author>Jane Smith</author>\n    <price>29.99</price>\n  </book>\n  <book>\n    <title>JavaScript Guide</title>\n    <author>John Doe</author>\n    <price>24.99</price>\n  </book>\n</catalog>\n",
        "is_valid_json": true,
        "root_element": "catalog",
        "element_count": 9
    }
}

Authentication and limits

This endpoint needs an API key. Use the sandbox ("try it" above) to test it without registering. See the authentication guide for details.

Standard rate limits apply to this endpoint.

More documentation

Get a free API key

A temporary key takes one click and no signup. Register and you get 75 requests/day. Free tier is for development & small projects.

cookies

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