JSON to XML API - convert JSON or JSONL into validated XML 1.0
json_to_xmlConvert a JSON object, array, JSON string, JSON Lines (NDJSON) or base64 JSON file into clean, validated XML 1.0. Supports custom root and array item tags, automatic plural-to-singular array element names (orders -> order), @attr to XML attributes and #text content, xsi:nil or omit null handling, XML tag sanitization, and pretty-print or minified output. Deterministic (lxml), 0 AI, nothing stored. Free: 5 calls/day per IP. Paid: Radar API key (from €9/mo at https://radarbg.com/pricing#starter via X-API-Key) or $0.001/call via x402 at https://radarbg.com/x402/json-to-xml.
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": {
"json": {
"catalog": {
"orders": [
{
"@id": "A-100",
"total": 146,
"customer": "Atlas Garage"
}
],
"@currency": "EUR"
}
},
"format": "pretty",
"smartArrayNames": true
},
"name": "json_to_xml"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| json | No | JSON object, array, or JSON/JSONL string to convert (empty = built-in sample order catalog) | |
| format | No | Pretty-printed or single-line minified XML | pretty |
| indent | No | Indentation when format=pretty | 2 |
| fileName | No | Optional file name, e.g. orders.json | |
| itemName | No | Fallback element name for array items | item |
| nullMode | No | Null handling: self-closing tag, xsi:nil='true', or omit | empty |
| rootName | No | Root XML element name when needed | root |
| fileContent | No | Optional base64-encoded .json or .jsonl file (max 5 MB) | |
| xmlDeclaration | No | Include <?xml version='1.0' encoding='UTF-8'?> header | |
| parseAttributes | No | Map @key fields to XML attributes and #text to element text | |
| smartArrayNames | No | Singularize plural parent keys for array items (orders -> order) | |
| unwrapSingleRoot | No | Use a single top-level JSON key as the root element |