XML to JSON API - convert XML, RSS, SOAP or UBL into structured JSON
xml_to_jsonConvert an XML string or base64 XML/RSS/Atom/SOAP/SVG/UBL file into clean, validated JSON or JSON Lines (.jsonl). Supports smart number/boolean/xsi:nil detection (while preserving leading-zero ZIP/IDs as strings), configurable attribute prefix (@, _, plain or omit), XML namespace stripping or prefix retention, force-array tag lists, keep/unwrap root, and pretty or minified output. Deterministic (XXE-safe lxml), 0 AI, nothing stored. Free: 5 calls/day per IP. Paid: Radar API key (from €15/mo at https://radarbg.com/pricing#starter via X-API-Key) or $0.001/call via x402 at https://radarbg.com/x402/xml-to-json.
Example tool call
This call uses example arguments supplied in the tool’s input schema.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"xml": "<catalog currency=\"EUR\"><orders><order id=\"A-100\" paid=\"true\"><customer>Atlas Garage</customer><total>146.50</total></order></orders></catalog>",
"alwaysArray": "order",
"detectTypes": true,
"attributeMode": "at"
},
"name": "xml_to_json"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| xml | No | XML text to convert (provide xml, text, or fileContent) | |
| format | No | Pretty-printed JSON, single-line minified JSON, or JSON Lines (.jsonl) | pretty |
| indent | No | Indentation when format=pretty | 2 |
| fileName | No | Optional file name, e.g. catalog.xml | |
| keepRoot | No | Keep the root XML tag as the top-level JSON key | |
| alwaysArray | No | Optional comma-separated tag names (or array of strings) to always output as JSON arrays even when only 1 item exists | |
| detectTypes | No | Convert numbers, true/false and xsi:nil='true' while keeping leading-zero IDs as strings | |
| fileContent | No | Optional base64-encoded .xml / .rss / .svg / .kml file (max 5 MB) | |
| emptyTagMode | No | Empty element (<tag/>) value: null or empty string | null |
| attributeMode | No | How XML attributes become JSON keys: @id, _id, id, or ignore | at |
| stripNamespaces | No | Remove XML namespace URIs from tag names |