XML to JSON Converter
Convert XML content to a JSON object
Parameters
| name | in | type | required | description |
|---|---|---|---|---|
xml |
body | string | required | XML Content |
pretty |
body | boolean | optional | Pretty Print |
preserve_attributes |
body | boolean | optional | Include XML attributes prefixed with @ |
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/xml-to-json" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"xml":"..."}'
Response
The result sits under data in the standard envelope. See the
response format guide for errors and status codes.
returns
- data.json
- The converted JSON as a string, attributes prefixed with @.
- data.root_element
- Name of the XML root element.
- data.element_count
- Number of XML elements parsed.
{
"status": "success",
"http_code": 200,
"code": "SUCCESS",
"message": "XML converted to JSON successfully",
"data": {
"json": "{\n \"catalog\": {\n \"book\": [\n {\n \"@id\": \"1\",\n \"title\": \"PHP Handbook\",\n \"author\": \"Jane Smith\",\n \"price\": {\n \"@currency\": \"USD\",\n \"#text\": \"29.99\"\n }\n },\n {\n \"@id\": \"2\",\n \"title\": \"JavaScript Guide\",\n \"author\": \"John Doe\",\n \"price\": {\n \"@currency\": \"USD\",\n \"#text\": \"24.99\"\n }\n }\n ]\n }\n}",
"is_valid_xml": 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.
related endpoints
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.