# XML ↔ JSON Converter (`automation-lab/xml-json-converter`) Actor

🔄 Convert between XML and JSON in both directions. Handles RSS feeds, SOAP responses, config files, and any structured data. Supports attributes, CDATA, arrays, URL input, and bulk processing.

- **URL**: https://apify.com/automation-lab/xml-json-converter.md
- **Developed by:** [Stas Persiianenko](https://apify.com/automation-lab) (community)
- **Categories:** Developer tools, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## XML ↔ JSON Converter

> Instantly convert XML to JSON or JSON to XML — bidirectional, fast, and free to try. Handles RSS feeds, SOAP responses, config files, API payloads, and any structured data format. No proxy, no scraping — pure computation.

---

### What Does It Do?

The **XML ↔ JSON Converter** transforms data between XML and JSON formats in both directions:

- 📄 **XML → JSON**: Parse any XML document (RSS feeds, SOAP responses, sitemaps, config files) into clean JSON
- 🔁 **JSON → XML**: Serialize JSON objects or arrays back into well-formed XML
- 🤖 **Auto-detect mode**: Paste data without specifying the format — the actor detects whether it's XML or JSON automatically
- 🔗 **URL input**: Provide a URL to an XML or JSON file — the actor fetches and converts it
- 📦 **Bulk mode**: Process multiple conversion tasks in a single run using the `inputs` array

Data passes through the [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) library — a battle-tested, high-performance parser used by millions of npm projects.

---

### Who Is It For?

#### Backend Developers
You're integrating with a legacy SOAP API that returns XML, but your app speaks JSON. This actor handles the translation as a step in your pipeline — no custom parsing code required.

#### Data Engineers & ETL Pipeline Builders
You receive RSS/Atom feeds, Sitemap XML files, or third-party XML exports and need them as JSON for downstream processing in tools like n8n, Make, or Zapier. Feed the URLs in, get JSON out.

#### No-Code / Low-Code Automators
You're building workflows in n8n or Make and hit a wall because an API returns XML. Drop this actor in as a conversion step and carry on with JSON-native logic.

#### QA Engineers & API Testers
You're testing SOAP/REST hybrid APIs and need to quickly inspect or transform XML payloads during debugging sessions.

#### System Administrators
You manage configuration files in XML (pom.xml, web.config, Ant build files) and want them as JSON for tooling, validation, or migration.

---

### Why Use This Actor?

- ⚡ **Instant results** — pure computation, no browser, no proxy, no scraping delays
- 🏷️ **Attribute preservation** — XML element attributes are captured under `@attributes` keys, not lost
- 🌊 **CDATA support** — CDATA sections are handled natively via the `__cdata` property
- 📐 **Correct array detection** — repeated sibling XML elements automatically become JSON arrays
- 🎛️ **Flexible output** — pretty-printed or compact, custom root element names, custom array item node names
- 💸 **Ultra-low cost** — $0.01 start + $0.0015 per conversion (see Pricing below)
- 🔗 **URL input supported** — fetch and convert remote XML/JSON files by URL directly

---

### Extracted Data

Each conversion task produces one output item in the dataset:

| Field | Type | Description |
|-------|------|-------------|
| `inputIndex` | Number | Task sequence number (1-based) |
| `mode` | String | Actual conversion mode used: `xmlToJson` or `jsonToXml` |
| `outputFormat` | String | Output format: `json` or `xml` |
| `inputPreview` | String | First 150 characters of input data |
| `output` | String | The converted output (JSON string or XML string) |
| `error` | String | Error message if the conversion failed (field absent on success) |

---

### How Much Does It Cost to Convert XML to JSON?

Pricing uses **Pay-Per-Event** — you only pay for what you use. There are no monthly subscriptions.

| Event | FREE Plan | BRONZE | SILVER | GOLD | PLATINUM | DIAMOND |
|-------|-----------|--------|--------|------|----------|---------|
| Run start (one-time) | $0.010 | $0.0095 | $0.0085 | $0.0075 | $0.0060 | $0.0050 |
| Per conversion | $0.0015 | $0.00135 | $0.0012 | $0.00098 | $0.00075 | $0.0006 |

**Example costs:**
- Convert 1 XML file: ~$0.0115 (start + 1 conversion)
- Convert 10 XML files in bulk: ~$0.025 (start + 10 conversions)
- Convert 100 files in bulk: ~$0.160 (start + 100 conversions)

All Apify accounts include **a free monthly compute budget** to try actors at no charge. The FREE plan pricing applies within that budget.

---

### How to Use the XML ↔ JSON Converter

#### Step 1: Choose Your Input Method
You can provide input data in two ways:
1. **Paste data directly** — put your XML or JSON string in `inputData`
2. **Provide a URL** — put the URL of an XML or JSON file in `inputUrl`

#### Step 2: Select the Conversion Mode
- **Auto-detect** (recommended): the actor inspects your input and picks the right direction automatically
- **XML → JSON**: explicitly convert XML to JSON
- **JSON → XML**: explicitly convert JSON to XML

#### Step 3: Configure Options
- **Parse XML Attributes**: include element attributes in JSON output (under `@attributes` key)
- **Root Element Name**: when generating XML from JSON, wrap output in this root element (default: `root`)
- **Pretty Print**: format output with indentation (recommended for readability)
- **Array Item Node Name**: when a JSON array is at the root, wrap each item in this XML element name (default: `item`)

#### Step 4: Run and Collect Results
Click **Start** and the results appear in the **Dataset** tab. Each conversion task produces one row. Download as JSON, CSV, or use the API.

---

### Input Parameters

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `inputs` | Array | — | Array of conversion tasks (bulk mode). Each item can override all other settings. |
| `mode` | String | `auto` | Conversion direction: `auto`, `xmlToJson`, or `jsonToXml` |
| `parseAttributes` | Boolean | `true` | Include XML attributes in JSON output under `@attributes` key |
| `rootElement` | String | `root` | Root XML element name when converting JSON → XML |
| `prettyPrint` | Boolean | `true` | Format output with indentation and line breaks |
| `arrayNodeName` | String | `item` | XML element name for array items when root is a JSON array |

#### Bulk Mode Input Item
Each item in the `inputs` array supports:

| Field | Type | Description |
|-------|------|-------------|
| `inputData` | String | Raw XML or JSON string to convert |
| `inputUrl` | String | URL of an XML or JSON file to fetch and convert |
| `mode` | String | Override conversion mode for this task |
| `parseAttributes` | Boolean | Override attribute parsing for this task |
| `rootElement` | String | Override root element for this task |
| `prettyPrint` | Boolean | Override pretty-print for this task |
| `arrayNodeName` | String | Override array item node name for this task |

---

### Output Examples

#### XML → JSON (with attributes)

**Input XML:**
```xml
<catalog>
  <book id="1">
    <title>The Great Gatsby</title>
    <author>F. Scott Fitzgerald</author>
    <price>9.99</price>
  </book>
  <book id="2">
    <title>To Kill a Mockingbird</title>
    <author>Harper Lee</author>
    <price>12.99</price>
  </book>
</catalog>
````

**Output JSON:**

```json
{
  "catalog": {
    "book": [
      {
        "@attributes": { "id": 1 },
        "title": "The Great Gatsby",
        "author": "F. Scott Fitzgerald",
        "price": 9.99
      },
      {
        "@attributes": { "id": 2 },
        "title": "To Kill a Mockingbird",
        "author": "Harper Lee",
        "price": 12.99
      }
    ]
  }
}
```

#### JSON → XML

**Input JSON:**

```json
{
  "employees": [
    {"name": "Alice", "role": "Engineer"},
    {"name": "Bob", "role": "Manager"}
  ]
}
```

**Output XML (root element: `company`):**

```xml
<?xml version="1.0" encoding="UTF-8"?>
<company>
  <employees>
    <name>Alice</name>
    <role>Engineer</role>
  </employees>
  <employees>
    <name>Bob</name>
    <role>Manager</role>
  </employees>
</company>
```

***

### Tips and Best Practices

💡 **Use auto-detect for quick conversions** — the actor correctly identifies XML (starts with `<`) vs JSON (starts with `{` or `[`) in virtually all cases.

💡 **Process RSS/Atom feeds via URL** — put the feed URL in `inputUrl` and set mode to `auto`. The actor fetches and converts in one step.

💡 **Bulk-convert multiple files in one run** — use the `inputs` array to process many files in a single run. This saves the start cost compared to launching separate runs for each file.

💡 **XML attributes are under `@attributes`** — when `parseAttributes` is true (default), element attributes are captured cleanly under a dedicated key, not mixed with child elements.

💡 **Repeated XML elements become JSON arrays automatically** — `fast-xml-parser` detects repeated sibling elements and converts them to arrays. You don't need to configure this.

💡 **Use compact output for storage** — set `prettyPrint: false` for compact output when you're piping the result into another system (saves bandwidth and storage).

💡 **Set a meaningful `rootElement` for JSON → XML** — instead of the generic `root`, use a domain-specific name like `products`, `orders`, or `employees` to produce readable XML.

***

### Integrations

#### n8n: Convert XML API Response to JSON

1. Use an **HTTP Request** node to call your XML API
2. Add an **Apify** node, select **XML ↔ JSON Converter**
3. Pass the response body as `inputData` with `mode: xmlToJson`
4. Use the JSON output in downstream nodes

#### Make (formerly Integromat): Transform Webhook Payloads

1. Receive an XML webhook payload in a **Webhooks** module
2. Call the **XML ↔ JSON Converter** via Apify's HTTP module
3. Parse the JSON output with Make's built-in JSON parser
4. Route to Google Sheets, Slack, or any other module

#### Zapier: RSS Feed to Structured Data

1. Trigger on a schedule with **Zapier Schedule**
2. Use **Webhooks by Zapier** to call the Apify API with the RSS feed URL
3. Parse the resulting JSON in downstream Zaps

#### Programmatic Pipeline (Node.js)

```javascript
const { ApifyClient } = require('apify-client');
const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });

const run = await client.actor('automation-lab/xml-json-converter').call({
    inputs: [
        { inputUrl: 'https://example.com/feed.xml', mode: 'auto' },
        { inputData: '{"key": "value"}', mode: 'jsonToXml', rootElement: 'data' }
    ]
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items.map(item => item.output));
```

***

### API Usage

#### Node.js

```javascript
const { ApifyClient } = require('apify-client');

const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });

const run = await client.actor('automation-lab/xml-json-converter').call({
    inputs: [
        {
            inputData: '<note><to>Tove</to><from>Jani</from><body>Hello!</body></note>',
            mode: 'xmlToJson',
            parseAttributes: true,
            prettyPrint: true
        }
    ]
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items[0].output);
```

#### Python

```python
from apify_client import ApifyClient

client = ApifyClient('YOUR_API_TOKEN')

run = client.actor('automation-lab/xml-json-converter').call(run_input={
    'inputs': [
        {
            'inputData': '<note><to>Tove</to><from>Jani</from><body>Hello!</body></note>',
            'mode': 'xmlToJson',
            'parseAttributes': True,
            'prettyPrint': True,
        }
    ]
})

items = client.dataset(run['defaultDatasetId']).list_items().items
print(items[0]['output'])
```

#### cURL

```bash
curl -X POST \
  "https://api.apify.com/v2/acts/automation-lab~xml-json-converter/runs?token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "inputs": [
      {
        "inputData": "<note><to>Tove</to><from>Jani</from><body>Hello!</body></note>",
        "mode": "xmlToJson"
      }
    ]
  }'
```

***

### Use With Claude AI (MCP)

You can use this actor directly inside **Claude Code**, **Claude Desktop**, **Cursor**, or **VS Code** via the Apify MCP server.

#### Claude Code

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=automation-lab/xml-json-converter"
```

#### Claude Desktop / Cursor / VS Code

Add to your MCP config (`claude_desktop_config.json` or `.cursor/mcp.json`):

```json
{
  "mcpServers": {
    "apify": {
      "type": "http",
      "url": "https://mcp.apify.com?tools=automation-lab/xml-json-converter",
      "headers": {
        "Authorization": "Bearer YOUR_APIFY_API_TOKEN"
      }
    }
  }
}
```

#### Example Prompts

Once connected, you can ask Claude:

- *"Convert this XML to JSON: `<book><title>Dune</title><author>Frank Herbert</author></book>`"*
- *"Fetch the RSS feed at https://example.com/feed.xml and convert it to JSON"*
- *"Turn this JSON array into an XML file with root element 'products' and item node 'product'"*
- *"I have 3 XML files to convert — process them all in one bulk run"*

***

### Legality

This actor converts data between formats. It does not scrape, crawl, or access any protected website. All data processing happens on the input you provide. Using this actor does not involve bypassing any access controls or terms of service.

***

### Frequently Asked Questions

#### What XML features are supported?

The actor supports all standard XML including: element attributes, CDATA sections, nested elements, text nodes, repeated elements (arrays), XML namespaces (treated as attributes), and XML with or without an XML declaration (`<?xml version="1.0"?>`).

#### Are XML namespaces supported?

Namespace prefixes (e.g., `<ns:element>`) are treated as part of the element name. Namespace declarations (`xmlns:ns="..."`) are captured as attributes when `parseAttributes` is enabled.

#### What happens if I provide invalid XML or JSON?

The actor catches the error gracefully and records it in the `error` field of the output item. Other tasks in a bulk run continue processing normally — one bad input doesn't stop the rest.

#### Can I convert very large XML files?

Yes — the actor runs in the Apify cloud with up to 256 MB RAM. For extremely large files (multi-MB XML), the conversion still completes efficiently because `fast-xml-parser` is a streaming-capable parser. If you hit memory limits, contact support.

#### Why are my repeated XML elements not becoming an array?

`fast-xml-parser` automatically converts repeated sibling elements with the same tag name into an array. If you see a single element not wrapped in an array, it's because there was only one occurrence of that tag in the input. This is correct behavior — a `<book>` tag that appears once is an object, not a single-element array.

#### Can I fetch XML from a URL that requires authentication?

Not currently. `inputUrl` supports public URLs only. For authenticated sources, fetch the XML yourself and pass it via `inputData`.

#### What's the difference between `rootElement` and `arrayNodeName`?

- `rootElement` (default: `root`) is the outer wrapper element that always wraps the entire JSON output when converting to XML
- `arrayNodeName` (default: `item`) is used when the JSON root is an array — each array element gets wrapped in an element with this name

***

### Related Actors

Looking for other format converters or data transformation tools?

- [JSON ↔ CSV Converter](https://apify.com/automation-lab/json-csv-converter) — Convert between JSON and CSV formats
- [Base64 Converter](https://apify.com/automation-lab/base64-converter) — Encode and decode Base64 strings
- [JSON Schema Generator](https://apify.com/automation-lab/json-schema-generator) — Generate JSON Schema from sample JSON data
- [JSONPath Extractor](https://apify.com/automation-lab/jsonpath-extractor) — Extract values from JSON using JSONPath expressions
- [JSON Validator](https://apify.com/automation-lab/json-validator) — Validate JSON syntax and structure

# Actor input Schema

## `inputs` (type: `array`):

Add one or more conversion tasks. Each item can have its own inputData or inputUrl and mode.

## `mode` (type: `string`):

Select the conversion direction. Use 'auto' to detect format automatically based on the input content.

## `parseAttributes` (type: `boolean`):

When converting XML → JSON, include XML element attributes in the output. Attributes are placed under an '@attributes' key per element.

## `rootElement` (type: `string`):

When converting JSON → XML, wrap the output in this root element. Leave empty to use 'root' as the default wrapper.

## `prettyPrint` (type: `boolean`):

Format the output with indentation and line breaks for readability. Disable for compact output (useful for storage or transmission).

## `arrayNodeName` (type: `string`):

When a JSON array has no natural key (e.g. the root is an array), wrap each item in this XML element. Default is 'item'.

## Actor input object example

```json
{
  "inputs": [
    {
      "inputData": "<catalog><book id=\"1\"><title>The Great Gatsby</title><author>F. Scott Fitzgerald</author><price>9.99</price></book><book id=\"2\"><title>To Kill a Mockingbird</title><author>Harper Lee</author><price>12.99</price></book></catalog>",
      "mode": "auto"
    }
  ],
  "mode": "auto",
  "parseAttributes": true,
  "rootElement": "root",
  "prettyPrint": true,
  "arrayNodeName": "item"
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "inputs": [
        {
            "inputData": "<catalog><book id=\"1\"><title>The Great Gatsby</title><author>F. Scott Fitzgerald</author><price>9.99</price></book><book id=\"2\"><title>To Kill a Mockingbird</title><author>Harper Lee</author><price>12.99</price></book></catalog>",
            "mode": "auto"
        }
    ],
    "mode": "auto",
    "rootElement": "root",
    "arrayNodeName": "item"
};

// Run the Actor and wait for it to finish
const run = await client.actor("automation-lab/xml-json-converter").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "inputs": [{
            "inputData": "<catalog><book id=\"1\"><title>The Great Gatsby</title><author>F. Scott Fitzgerald</author><price>9.99</price></book><book id=\"2\"><title>To Kill a Mockingbird</title><author>Harper Lee</author><price>12.99</price></book></catalog>",
            "mode": "auto",
        }],
    "mode": "auto",
    "rootElement": "root",
    "arrayNodeName": "item",
}

# Run the Actor and wait for it to finish
run = client.actor("automation-lab/xml-json-converter").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "inputs": [
    {
      "inputData": "<catalog><book id=\\"1\\"><title>The Great Gatsby</title><author>F. Scott Fitzgerald</author><price>9.99</price></book><book id=\\"2\\"><title>To Kill a Mockingbird</title><author>Harper Lee</author><price>12.99</price></book></catalog>",
      "mode": "auto"
    }
  ],
  "mode": "auto",
  "rootElement": "root",
  "arrayNodeName": "item"
}' |
apify call automation-lab/xml-json-converter --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=automation-lab/xml-json-converter",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "XML ↔ JSON Converter",
        "description": "🔄 Convert between XML and JSON in both directions. Handles RSS feeds, SOAP responses, config files, and any structured data. Supports attributes, CDATA, arrays, URL input, and bulk processing.",
        "version": "0.1",
        "x-build-id": "Z2gBGmbBElXBXMHfC"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/automation-lab~xml-json-converter/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-automation-lab-xml-json-converter",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/automation-lab~xml-json-converter/runs": {
            "post": {
                "operationId": "runs-sync-automation-lab-xml-json-converter",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/automation-lab~xml-json-converter/run-sync": {
            "post": {
                "operationId": "run-sync-automation-lab-xml-json-converter",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "inputs": {
                        "title": "📋 Inputs",
                        "type": "array",
                        "description": "Add one or more conversion tasks. Each item can have its own inputData or inputUrl and mode."
                    },
                    "mode": {
                        "title": "🔄 Conversion Mode",
                        "enum": [
                            "auto",
                            "xmlToJson",
                            "jsonToXml"
                        ],
                        "type": "string",
                        "description": "Select the conversion direction. Use 'auto' to detect format automatically based on the input content.",
                        "default": "auto"
                    },
                    "parseAttributes": {
                        "title": "🏷️ Parse XML Attributes",
                        "type": "boolean",
                        "description": "When converting XML → JSON, include XML element attributes in the output. Attributes are placed under an '@attributes' key per element.",
                        "default": true
                    },
                    "rootElement": {
                        "title": "🌳 Root Element Name (JSON → XML)",
                        "type": "string",
                        "description": "When converting JSON → XML, wrap the output in this root element. Leave empty to use 'root' as the default wrapper.",
                        "default": "root"
                    },
                    "prettyPrint": {
                        "title": "✨ Pretty Print Output",
                        "type": "boolean",
                        "description": "Format the output with indentation and line breaks for readability. Disable for compact output (useful for storage or transmission).",
                        "default": true
                    },
                    "arrayNodeName": {
                        "title": "📦 Array Item Node Name (JSON → XML)",
                        "type": "string",
                        "description": "When a JSON array has no natural key (e.g. the root is an array), wrap each item in this XML element. Default is 'item'.",
                        "default": "item"
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
