Skip to main content
Glama

JSON to XML API - convert JSON or JSONL into validated XML 1.0

json_to_xml
Read-onlyIdempotent

Convert 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

NameRequiredDescriptionDefault
jsonNoJSON object, array, or JSON/JSONL string to convert (empty = built-in sample order catalog)
formatNoPretty-printed or single-line minified XMLpretty
indentNoIndentation when format=pretty2
fileNameNoOptional file name, e.g. orders.json
itemNameNoFallback element name for array itemsitem
nullModeNoNull handling: self-closing tag, xsi:nil='true', or omitempty
rootNameNoRoot XML element name when neededroot
fileContentNoOptional base64-encoded .json or .jsonl file (max 5 MB)
xmlDeclarationNoInclude <?xml version='1.0' encoding='UTF-8'?> header
parseAttributesNoMap @key fields to XML attributes and #text to element text
smartArrayNamesNoSingularize plural parent keys for array items (orders -> order)
unwrapSingleRootNoUse a single top-level JSON key as the root element

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already declare readOnly/openWorld/idempotent, and the description adds genuinely new operational context: deterministic lxml engine, no AI, nothing stored, a 5-calls/day free tier, and both auth paths (X-API-Key or x402). It stops short of stating size/pagination limits in prose (the 5 MB cap lives in the schema) or how errors surface, so it is strong rather than complete.

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

Conciseness4/5

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

Purpose is front-loaded in sentence one, capabilities follow, and commercial terms come last where they belong. The closing pricing/URL sentence is dense but functional; a couple of listed features restate what the schema already names, which is the only real waste.

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 a 12-parameter, zero-required conversion tool with no output schema, the description covers input modalities, key formatting behaviors, determinism, storage policy, and cost/auth. What it omits is the shape of the returned XML document and error behavior, which matters slightly given no output schema exists.

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

Parameters3/5

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

Schema description coverage is 100%, so the baseline is 3. The prose does reinforce the intent behind several parameters (custom root/item tags, plural-to-singular array names, @attr/#text mapping, xsi:nil/omit null handling, pretty vs minified), which adds real meaning beyond the field-level descriptions, but not enough to justify a 4–5 when the schema already documents all 12 parameters.

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 first sentence states a specific verb and resource ('Convert ... into clean, validated XML 1.0') and enumerates the accepted input forms (JSON object, array, JSON string, JSONL/NDJSON, base64 file). That scope makes it distinguishable from siblings like json_to_yaml and xml_to_excel without opening their schemas.

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 is only implied: the enumerated input types tell an agent what this tool accepts, and the pricing/API-key lines tell it how access works, but there is no explicit when-to-use guidance and no named alternative for cases such as formatting or repairing JSON before conversion. Adequate, not instructive.

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