XML to JSON converter API
Convert an XML document to JSON: attributes become "@name" keys, text becomes "#text" (or the value itself when an element only holds text), and repeated child elements become arrays. DOCTYPEs and external entities are refused, so nothing outside the document is ever loaded. Up to 100,000 characters. Use to read XML feeds, SOAP responses and config files in an agent.
When to use it
- Read XML feeds, SOAP responses and config files as JSON in an agent
- Keep attributes as "@name" keys and repeated elements as arrays
- Convert documents up to 100,000 characters
Inputs
| Name | Type | Description |
|---|---|---|
xml (required) | string | The XML document |
Request
Over HTTP, with a card key from /credits:
curl -H "Authorization: Bearer adt_…" "https://agent-data-tools.revmesh2074.workers.dev/xml/to-json?xml=%3Corder%20id%3D%227%22%3E%3Citem%20sku%3D%22a1%22%3EPen%3C%2Fitem%3E%3Citem%20sku%3D%22b2%22%3EInk%3C%2Fitem%3E%3C%2Forder%3E"
Or one of your 25 free calls, no key:
curl "https://agent-data-tools.revmesh2074.workers.dev/xml/to-json?xml=%3Corder%20id%3D%227%22%3E%3Citem%20sku%3D%22a1%22%3EPen%3C%2Fitem%3E%3Citem%20sku%3D%22b2%22%3EInk%3C%2Fitem%3E%3C%2Forder%3E&trial=1"
Without a key, the same URL answers 402 Payment Required with x402 and MPP terms, so an agent with a wallet pays per call in USDC (Base, Polygon, Arbitrum or Solana over x402; Base or Tempo over MPP) and retries.
Example result
{
"root": "order",
"json": {
"order": {
"@id": "7",
"item": [
{
"@sku": "a1",
"#text": "Pen"
},
{
"@sku": "b2",
"#text": "Ink"
}
]
}
}
}
From an AI agent (MCP)
Add the MCP server to Claude, Cursor or any MCP client. This tool is xml_to_json, and the first 25 successful calls are free:
https://agent-data-tools.revmesh2074.workers.dev/mcp
Questions
Is it safe with untrusted XML?
DOCTYPE declarations are refused, so no external entity or file is ever loaded.
What happens with malformed XML?
The call is refused with a 400 and nothing is charged.
How do I pay?
Each successful call costs $0.01; failed calls are not charged. The first 25 calls are free. Then pay with card credits (from $5) or per call in USDC over x402 or MPP. No account or API key is needed.