# 24KLabs XML↔JSON Converter

> 24KLabs 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-09-13).

Bidirectionally converts between XML and JSON, mapping attributes with @ prefix, text content as #text, and repeated tags as arrays.

## Facts

- Endpoint: POST https://api.24klabs.ai/api/xml-json-convert
- Price: $0.003/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/24klabs-xml-json-converter-5522f298
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_UYGQTkPGLfu55-n2kiqKJ

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 24klabs-xml-json-converter-5522f298 -d '<json body>'
```

Example prompt: Convert this XML string to JSON for me — attributes should be prefixed with @ and text content as #text: '<root id="1"><item>hello</item><item>world</item></root>'

## When to prefer this

Choose this endpoint when you need bidirectional XML↔JSON conversion with a specific, well-defined mapping convention (@ for attributes, #text for text nodes, arrays for repeated tags) — ideal for processing SOAP/RSS/Atom XML feeds, integrating with legacy XML APIs, or preparing JSON data for XML-only consumers. Prefer this over generic parsers when you need consistent, predictable attribute and text node handling.

## Known failure modes

- Malformed XML input causes parse error
- Invalid JSON input causes serialization failure
- Missing or invalid 'from'/'to' direction parameter
- Deeply nested or circular structures may not round-trip cleanly
- Binary or non-UTF-8 encoded content may fail

## 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

A converted string in the target format: if converting XML→JSON, returns a JSON object with attributes prefixed by @, text nodes as #text, and repeated sibling tags collapsed into arrays; if converting JSON→XML, returns a well-formed XML string.

## 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/24klabs-xml-json-converter-5522f298/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)
