# fittings XML to JSON Converter

> fittings XML to JSON Converter is a paid API for AI agents from fittings.sh, paid per call via x402, $0.0045/call, status unknown (last checked 2026-09-14).

Converts an XML document into an ordered JSON tree with resolved namespaces, attributes, CDATA sections, and mixed content fully preserved.

## Facts

- Endpoint: POST https://fittings.sh/v1/fmt/xml-to-json
- Price: $0.0045/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/fittings-xml-to-json-converter-518075f1
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap__skN0MqOQz5winrIrFPeo

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 fittings-xml-to-json-converter-518075f1 -d '<json body>'
```

Example prompt: Convert this XML document to JSON for me, keeping whitespace-only text nodes: <?xml version="1.0"?><root xmlns:ns="http://example.com"><ns:item id="1"><![CDATA[Hello & World]]></ns:item></root>

## When to prefer this

Choose this endpoint when you need a faithful, structure-preserving XML-to-JSON conversion that handles namespaces, attributes, CDATA sections, and mixed content correctly — scenarios where naive regex or simple parsers would lose information. Ideal for processing SOAP responses, XML feeds, legacy config files, or any XML where namespace resolution matters. Prefer over generic transformation tools when correctness and ordering of the JSON tree are important.

## Known failure modes

- Malformed or invalid XML input returns a parse error
- Input exceeding 1,000,000 characters or 50,000 nodes is rejected
- Non-UTF-8 encoded XML may cause parsing failures
- Payment not included or insufficient USDC balance results in 402 error
- Extremely deeply nested XML may cause stack overflows or timeouts

## How this service works

Convert an XML document to an ordered JSON tree with resolved namespaces, attributes, CDATA and mixed content preserved.

## Output

An ordered JSON tree representation of the input XML document, with resolved namespace prefixes and URIs, element attributes included as JSON properties, CDATA sections and text nodes preserved, and mixed content (elements interspersed with text) faithfully represented. Optional whitespace-only text nodes are included or omitted based on the preserveWhitespace flag.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "xml": {
   "type": "string",
   "description": "XML document, up to 1000000 characters and 50000 nodes"
  },
  "preserveWhitespace": {
   "type": "boolean",
   "description": "Keep whitespace-only text nodes. Default false"
  }
 }
}
```

## More

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