BookatlasTwo-Day MuleSoft → Salesforce Bootcamp
5 / 81 · Module 3 — DataWeave 2.0 Crash Course · filtered: interview← prev⊞ allnext →

3.30Transform XML → JSON

Mule integrations aren't always JSON.

Input:

<customer>
    <id>C001</id>
    <name>Acme Corporation</name>
</customer>

DataWeave:

%dw 2.0
output application/json
---
{
    customerId: payload.customer.id,
    companyName: payload.customer.name
}

Output:

{
  "customerId": "C001",
  "companyName": "Acme Corporation"
}

One of DataWeave's core strengths is handling format conversion—JSON, XML, CSV, Java structures, and other formats—without you manually writing parsing/serialization plumbing.