# 402utils XML-to-JSON Converter

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

Converts raw XML documents to clean, structured JSON with attribute mapping, array coercion, and anti-XXE security protections

## Facts

- Endpoint: POST https://402utils.com/v1/xml-to-json?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-12
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/402utils-xml-to-json-converter-626c51ff
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_0Bfd3B0gAYP3v1wqJGHIN

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 402utils-xml-to-json-converter-626c51ff -d '<json body>'
```

Example prompt: Convert this XML to JSON for me — make sure the 'item' and 'entry' tags always come back as arrays even if there's only one of them: <?xml version="1.0"?><feed><entry><title>Hello</title></entry></feed>

## When to prefer this

Use this endpoint when you need to convert XML to JSON with fine-grained control over attribute mapping and array coercion, especially when the source XML may have single-occurrence tags that should always parse as arrays. Prefer this over generic XML libraries when you need built-in XXE protection, a simple HTTP API without dependencies, and predictable '@_' attribute key conventions. Ideal for parsing SOAP responses, RSS/Atom feeds, configuration files, or any XML API response that needs to be consumed as JSON by downstream code.

## Known failure modes

- XML exceeds 5 MB limit — request rejected
- DTD entity declarations or DOCTYPE internal subsets present — rejected with 422 to prevent XXE/billion-laughs attacks
- Malformed or non-well-formed XML — parse error returned
- Invalid Content-Type (must be application/xml, text/plain, or application/json envelope)
- alwaysArray list exceeds 100 tag names — rejected
- Network timeout on large documents near the size limit

## How this service works

Convert XML to clean JSON. POST raw XML (XML or text/plain Content-Type) or a JSON envelope {xml, alwaysArray}. Attributes land under "@_" keys, mixed-content text under "#text", repeated siblings become arrays, and alwaysArray forces arrays for listed tags even on a single occurrence. Numeric character references decode. DTD entities and DOCTYPE internal subsets rejected (anti-XXE / billion-laughs). Max 5 MB.

## Output

A JSON object where XML elements become object keys, attributes are stored under '@_' keys, mixed-content text goes under '#text' keys, repeated sibling elements become arrays, and any tags listed in alwaysArray are always arrays even with a single occurrence. Numeric character references are decoded. DTD entities and DOCTYPE internal subsets are rejected with a 422 error.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "xml": {
   "type": "string",
   "description": "XML document to convert. Max 5 MB UTF-8. DTD entity declarations and DOCTYPE internal subsets are rejected (422)."
  },
  "alwaysArray": {
   "type": "array",
   "items": {
    "type": "string"
   },
   "description": "Tag names that must always parse as arrays, even when only one occurrence exists (max 100)."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "json": {
   "order": {
    "@_id": "A-17",
    "item": [
     {
      "#text": "Café grinder",
      "@_sku": "X1"
     },
     {
      "#text": "Filter",
      "@_sku": "X2"
     }
    ]
   }
  },
  "root": "order"
 }
}
```

## More

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