> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bringits.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XML Parse

> Parse an XML string into a structured JSON object

The XML Parse command (Command Type: 1019) parses an XML string into a structured JSON object, preserving the hierarchy and attributes of the original XML.

## Overview

The XML Parse command provides functionality for:

* Converting XML strings into structured JSON objects
* Preserving XML hierarchy and nested elements
* Customizing attribute name prefixes in the output

## Command Type

**Command Type ID:** 1019

## Parameters

| Parameter               | Type   | Description                                                           | Required |
| ----------------------- | ------ | --------------------------------------------------------------------- | -------- |
| **attributeNamePrefix** | string | The prefix to add to attribute names in the output. Defaults to `"@"` | No       |

## Usage Examples

### Parse XML with Default Attribute Prefix

```json theme={null}
{
  "command": "xml-parse",
  "params": {}
}
```

### Parse XML with Custom Attribute Prefix

```json theme={null}
{
  "command": "xml-parse",
  "params": {
    "attributeNamePrefix": "attr_"
  }
}
```

### Parse XML with No Attribute Prefix

```json theme={null}
{
  "command": "xml-parse",
  "params": {
    "attributeNamePrefix": ""
  }
}
```

## Output Structure

Given input XML:

```xml theme={null}
<event id="123" status="active">
  <name>Match 1</name>
</event>
```

With default `attributeNamePrefix: "@"`, the output is:

```json theme={null}
{
  "event": {
    "@id": "123",
    "@status": "active",
    "name": "Match 1"
  }
}
```

## Common Use Cases

* **SOAP / XML APIs**: Parse XML responses from legacy or sports data APIs
* **Feed Parsing**: Convert XML-based data feeds into JSON for downstream processing
* **Attribute Extraction**: Access XML element attributes as prefixed JSON keys

## Related Commands

* [Decode](/stream/commands/parse/decode) - Decode compressed binary payloads
* [Json Path](/stream/commands/parse/json-path) - Extract fields from the parsed JSON
* [Key Mapping](/stream/commands/parse/key-mapping) - Remap XML-derived field names
