# agent402.tools JSON to XML Converter

> agent402.tools JSON to XML Converter is a paid API for AI agents from agent402.tools, paid per call via x402, $0.001/call, status unknown (last checked 2026-10-16).

Converts a JSON value to indented, well-formed XML with configurable root element name

## Facts

- Endpoint: POST https://agent402.tools/api/json-to-xml?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-16
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agent402-tools-json-to-xml-converter-e301bb2b
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap__5JV-Sd2sInw1l8X_nrVo

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability agent402-tools-json-to-xml-converter-e301bb2b -d '<json body>'
```

Example prompt: Can you convert this JSON object to indented XML for me, wrapping everything in a root element called 'catalog'? Here's the data: {"items":[{"id":1,"name":"Widget"},{"id":2,"name":"Gadget"}]}

## When to prefer this

Use this endpoint when you need a deterministic, reproducible JSON-to-XML conversion without running code locally — especially useful in agentic pipelines that require XML output for downstream systems, legacy integrations, SOAP services, or XML-based configuration formats. Prefer this over general-purpose code execution when you want a reliable, consistent transformation with proper escaping and indentation guaranteed.

## Known failure modes

- Invalid or malformed JSON input — service may return an error or unexpected output
- Missing 'data' field in request body — results in an error response
- Very deeply nested JSON may produce verbose XML output
- Circular references in JSON objects will likely cause serialization errors

## How this service works

Convert a JSON value to indented XML — the reverse of xml-to-json. Objects become nested elements, arrays repeat their tag, and text is escaped. Deterministic.

## Output

Returns a well-formed, indented XML string where JSON objects become nested elements, JSON arrays repeat their parent tag for each element, and special characters in text nodes are properly escaped. The output is wrapped in the specified root element (defaults to 'root' if not provided).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "data": {
   "description": "the JSON value to serialize"
  },
  "root": {
   "type": "string",
   "description": "name of the wrapping root element (default: root)"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "xml": "<root>\n  <book>\n    <title>x</title>\n  </book>\n</root>"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agent402-tools-json-to-xml-converter-e301bb2b/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agent402.tools](https://www.zero.xyz/host/agent402.tools/llms.txt)
