Skip to main content
Glama

XML to JSON API - convert XML, RSS, SOAP or UBL into structured JSON

xml_to_json
Read-onlyIdempotent

Convert 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

NameRequiredDescriptionDefault
xmlNoXML text to convert (provide xml, text, or fileContent)
formatNoPretty-printed JSON, single-line minified JSON, or JSON Lines (.jsonl)pretty
indentNoIndentation when format=pretty2
fileNameNoOptional file name, e.g. catalog.xml
keepRootNoKeep the root XML tag as the top-level JSON key
alwaysArrayNoOptional comma-separated tag names (or array of strings) to always output as JSON arrays even when only 1 item exists
detectTypesNoConvert numbers, true/false and xsi:nil='true' while keeping leading-zero IDs as strings
fileContentNoOptional base64-encoded .xml / .rss / .svg / .kml file (max 5 MB)
emptyTagModeNoEmpty element (<tag/>) value: null or empty stringnull
attributeModeNoHow XML attributes become JSON keys: @id, _id, id, or ignoreat
stripNamespacesNoRemove XML namespace URIs from tag names

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / xml / description
      Previous value: -"XML text to convert (empty = built-in sample order catalog)"New value: +"XML text to convert (provide xml, text, or fileContent)"
  2. Added

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds meaningful behavior beyond the annotations: deterministic execution, XXE-safe lxml parsing, '0 AI', nothing stored, and concrete rate/lookup limits plus auth mechanisms. That covers the important non-obvious traits for a hosted conversion service. It stops short of describing error behavior (e.g., malformed XML) or response payload shape, so it is strong but not exhaustive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose sentence is correctly front-loaded and dense with useful facts, but the remainder is a long laundry list of features crammed into one sentence followed by a pricing sentence with two URLs. Every element is relevant, yet the lack of breaks or grouping makes it harder to scan than it needs to be.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an 11-parameter tool with no required fields and no output schema, the description covers inputs, formats, parsing semantics, safety, and cost/auth reasonably thoroughly, and the schema carries an example. The main gap is the absence of any description of the returned JSON structure or failure modes, which matters since no output schema exists to fill that in.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the 3 baseline is already met, but the description adds real meaning: it explains the rationale behind detectTypes ('preserving leading-zero ZIP/IDs as strings'), the four attribute-prefix modes (@, _, plain or omit), namespace stripping vs prefix retention, force-array tag lists, and keep/unwrap root. That maps natural-language behavior to the enum/boolean parameters in a way the schema alone does not.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a precise verb+resource pair ('Convert an XML string or base64 XML/RSS/Atom/SOAP/SVG/UBL file into clean, validated JSON or JSON Lines'), naming both the accepted input families and the two output formats. An agent can immediately tell this is the XML→JSON direction, distinguishing it from the sibling json_to_xml without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage context is implied by the input format list and by the stated free tier (5 calls/day per IP) plus paid access paths (Radar API key via X-API-Key, or x402 at $0.001/call), which tells an agent about cost and auth. However, there is no explicit when-to-use/when-not guidance and no routing to alternatives such as xml_to_excel or json_to_xml for the reverse direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources