# agent402.tools XML to JSON Converter

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

Parses an XML string into a structured JSON object tree, with attributes under _attrs and text content under _text, and repeated elements converted to arrays.

## Facts

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

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-xml-to-json-converter-2e7ae875 -d '<json body>'
```

Example prompt: Convert this XML into a JSON object for me: '<root><item id="1"><name>Widget</name></item><item id="2"><name>Gadget</name></item></root>' — I need attributes under _attrs and text under _text.

## When to prefer this

Use this endpoint when you have an XML string (e.g. from a legacy API, RSS feed, SOAP response, or config file) and need it converted to a navigable JSON structure with consistent attribute and text conventions (_attrs/_text). Prefer this over manual parsing or regex-based extraction when you need a reliable, structured tree rather than flat key-value extraction.

## Known failure modes

- Malformed or invalid XML returns a parse error
- XML payload exceeding 100KB may be rejected
- Missing or empty 'xml' field results in a validation error
- Extremely deeply nested XML may hit recursion limits
- Non-UTF-8 encoded XML may fail to parse

## How this service works

Parse XML into a JSON object tree (attributes under _attrs, text under _text; repeated elements become arrays).

## Output

A JSON object tree representing the parsed XML structure, where XML attributes are stored under _attrs keys, text content under _text keys, and repeated sibling elements are collapsed into arrays. The response allows downstream code to navigate the former XML hierarchy as native JSON.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "xml": {
   "type": "string",
   "description": "XML text (max 100KB)"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "json": {
   "user": {
    "name": "Ada",
    "_attrs": {
     "id": "1"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agent402-tools-xml-to-json-converter-2e7ae875/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)
