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 €15/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 (provide json, text, or fileContent)
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. Changed1 schema field changed
    • changedInput schema / properties / json / description
      Previous value: -"JSON object, array, or JSON/JSONL string to convert (empty = built-in sample order catalog)"New value: +"JSON object, array, or JSON/JSONL string to convert (provide json, text, or fileContent)"
  2. Added

TDQS

A4.3/5.0
Behavior5/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 behavioral context: deterministic lxml engine, no AI involvement, nothing stored, a 5 calls/day per-IP free limit, and the two auth paths (X-API-Key or x402 per-call payment). Rate limits and auth requirements are exactly the kind of context annotations cannot express.

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?

The first sentence front-loads the conversion and accepted inputs, followed by a capability list and then operational/pricing facts. It is dense but nearly every clause carries information; the pricing URLs and tier detail are the only mildly promotional padding, though they do serve the agent's auth decisions.

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?

With 12 optional parameters and no output schema, the description does enough: it states the output is validated XML 1.0 with pretty or minified formatting and explains the structural conventions the options control. What it lacks is any explicit description of the response envelope (e.g., whether XML is returned as a string field, along with errors), which would matter for chaining calls.

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 baseline is 3, but the description adds real meaning beyond the schema by illustrating behavior: plural-to-singular array naming (orders -> order), @attr to XML attributes and #text to element text, xsi:nil vs omit null handling, and custom root/item tags. These map parameter choices to concrete output effects rather than restating field names.

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 names a specific verb and resource ('Convert a JSON object, array, JSON string, JSON Lines (NDJSON) or base64 JSON file into clean, validated XML 1.0') and enumerates the exact input shapes accepted. The direction of conversion is unambiguous, which cleanly separates it from siblings like xml_to_json, csv_to_xml and json_to_yaml.

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 implied through the accepted input formats and the pricing/auth notes (free tier vs X-API-Key vs x402), which tells an agent the call is metered. However, there is no explicit when-to-use or when-not guidance and no named alternative (e.g., 'use csv_to_xml for CSV input'), so the agent must infer routing from sibling names alone.

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