XML Converter

XML Converter transforms data between XML and JSON formats. Use when integrating with systems that require XML or when parsing XML responses.

How to Add a XML Converter?

1

Click the Logic Processor icon in your flow

2

Select XML Converter from the list

3

Configure the data

4

Click Ok to save

Configuration

FieldDescriptionRequired
NameName for the conversion step in the flowYes
ModeDirection of conversion: XML → JSON or JSON → XMLYes
DataThe input data (XML or JSON) to convertYes

Conversion Modes

ModeUse When
XML → JSONYou need to map XML fields or transform incoming XML data into standard JSON structures.
JSON → XMLYou need to create XML requests or SOAP payloads to send to external systems.

Key Conversion Rules

XML → JSON

Nested objects

<Customer><Name>Ali</Name></Customer>
{ "Customer": { "Name": "Ali" } }

Arrays become repeated elements

<Items>
<Item>Apple</Item>
<Item>Orange</Item>
</Items>
{ "Items": { "Item": ["Apple", "Orange"] } }

Attributes use @_ prefix

<Item id="123">Apple</Item>
{ "Item": { "@_id": "123", "#text": "Apple" } }

Null values

<Email xsi:nil="true"/> 
{ "Email": null }

JSON → XML

Nested objects

{ "Customer": { "Name": "Ali" } }
<Customer><Name>Ali</Name></Customer>

Arrays become repeated elements

{ "Items": { "Item": ["Apple", "Orange"] } }
<Items>
<Item>Apple</Item>
<Item>Orange</Item>
</Items>

Attributes from @_ prefix

{ "Item": { "@_id": "123", "#text": "Apple" } }
<Item id="123">Apple</Item>

Null values

"Email"null } 
<Email xsi:nil="true"/>

Advanced Settings

The default conversion rules work for most APIs, but some systems expect a specific JSON or XML shape. Open the Advanced Settings panel on the XML Converter to fine-tune how attributes, arrays, whitespace, and the root element are handled.

Where to Start

You rarely need to touch more than one or two of these. Use this as a quick guide:

API rejects your XML because the root element is named incorrectlyRoot Name
API won't accept the <?xml ?> declarationHeadless
Mapping breaks when an XML list has only one itemExplicit Array
Attributes are getting in the wayIgnore Attributes or Merge Attributes
Text values have extra spaces or line breaksTrim and Normalize

XML → JSON Settings

SettingDefaultWhat It Does
Explicit ArrayOffTurn on to always wrap child nodes in an array, even when there's only one, useful when your mapping expects a list and a single-item payload would otherwise break it.
Attribute Key$The JSON key used to hold XML attributes. Change it if your destination expects a different prefix, like @.
Character Key#valueThe JSON key used to hold text content when an element has both attributes and text.
Explicit RootOnWhen on, the root element stays in the JSON. Turn off to unwrap it so its children become the top-level keys.
Ignore AttributesOffTurn on to discard all XML attributes and keep only text content, useful when you only care about the values.
Merge AttributesOffTurn on to flatten attributes into the parent element instead of nesting them under the Attribute Key. Has no effect if Ignore Attributes is on.
NormalizeOffCollapse multiple spaces, tabs, and line breaks inside text into single spaces.
TrimOffRemove leading and trailing whitespace from text values.
Normalize TagsOffConvert all tag names to lowercase in the JSON output.

Example: Explicit Root

// Input
<Order>
  <Customer>Ali</Customer>
  <Total>50.00</Total>
</Order>

// Explicit Root = ON
{ "Order": { "Customer": "Ali", "Total": "50.00" } }

// Explicit Root = OFF
{ "Customer": "Ali", "Total": "50.00" }

Example: Merge Attributes

// Input
<Product id="P1"><Name>Mouse</Name></Product>

// Merge Attributes = OFF
{ "Product": { "$": { "id": "P1" }, "Name": "Mouse" } }

// Merge Attributes = ON
{ "Product": { "id": "P1", "Name": "Mouse" } }

Example: Trim & Normalize

// Input
<Customer>  Ali   Hassan  </Customer>

// Trim = ON
{ "Customer": "Ali   Hassan" }

// Normalize = ON
{ "Customer": " Ali Hassan " }

// Trim = ON, Normalize = ON
{ "Customer": "Ali Hassan" }

JSON → XML Settings

SettingDefaultWhat It Does
Attribute Key$Tells Studio which JSON key holds XML attributes. Must match what your source JSON uses.
Character Key#valueTells Studio which JSON key holds the text content of an element.
HeadlessOffTurn on to omit the <?xml ?> declaration at the top. Some APIs (especially SOAP wrappers) reject requests that include it.
Root NamerootThe name of the wrapping element in the XML output. Change this to match what the target system expects (for example, Order or Envelope).
Field Validation
FieldLengthRules
Attribute Key
Character Key
1–20 charactersNo spaces, no digits at the start, no reserved characters (. [ ] ( ) : ; , " ' \), and the two keys must be different from each other (Unique).
Root Name1–30 charactersSame character rules as above, plus cannot start with xml (reserved by the XML spec).

Example: Headless

// Input
{ "Order": { "id": "123", "Customer": "Ali" } }

// Headless = OFF (default)
<?xml version="1.0" encoding="UTF-8"?>
<Order>
  <id>123</id>
  <Customer>Ali</Customer>
</Order>

// Headless = ON
<Order>
  <id>123</id>
  <Customer>Ali</Customer>
</Order>

Example: Root Name

// Input
{ "OrderID": "123" }

// Root Name = root (default)
<root><OrderID>123</OrderID></root>

// Root Name = Order
<Order><OrderID>123</OrderID></Order>

Related Articles