# XML ↔ JSON Converter

> XML ↔ JSON Converter is a paid API for AI agents from api.24klabs.ai, paid per call via x402, $0.003/call, status unknown (last checked 2026-10-20).

Bidirectionally converts between XML and JSON strings, with attributes prefixed by @, text nodes as #text, and repeated tags collapsed into arrays.

## Facts

- Endpoint: POST https://api.24klabs.ai/api/v1/xml-json-convert?utm_source=zero.xyz
- Price: $0.003/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-20
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/xml-json-converter-cdabafe2
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_ntZZLBbPWWw9p6ndk6TrF

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 xml-json-converter-cdabafe2 -d '<json body>'
```

Example prompt: Convert this XML string to JSON for me: '<users><user id="1"><name>Alice</name></user><user id="2"><name>Bob</name></user></users>' — direction is xml-to-json.

## When to prefer this

Choose this endpoint when you need a simple, reliable XML↔JSON round-trip conversion with consistent conventions (@ for attributes, #text for text nodes, arrays for repeated tags). Ideal for agents processing legacy XML APIs, RSS/Atom feeds, SOAP responses, or configuration files that need to be converted for downstream JSON-first systems — or vice versa.

## Known failure modes

- Malformed XML input causes parse error with descriptive message
- Invalid JSON input returns parse error
- Missing 'from' or 'to' direction parameter returns validation error
- Deeply nested or extremely large documents may hit size/depth limits
- Unsupported encoding or non-UTF-8 characters may cause transformation errors

## How this service works

Convert XML to JSON (attributes prefixed with @, text as #text, repeated tags become arrays) or JSON back to XML. Give from/to and the source string.

## Output

Returns the converted string in the target format. XML→JSON output uses @ prefix for XML attributes, #text for text node content, and collapses repeated sibling tags into arrays. JSON→XML output reconstructs the XML document from the JSON structure.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "to": {
   "type": "string"
  },
  "from": {
   "type": "string"
  },
  "input": {
   "type": "string"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "result": {
   "note": {
    "to": "Ann",
    "from": "Bo"
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/xml-json-converter-cdabafe2/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.24klabs.ai](https://www.zero.xyz/host/api.24klabs.ai/llms.txt)
