A language for transformation

Designed for data transformation, DataWeave allows you to easily read, manipulate, and write data in any format. Industry proven by trillions of transactions on mission critical applications.

Why DataWeave?

Simple format selection

Forget about serialization formats and focus on your logic: DataWeave will handle the specifics of JSON, XML, CSV, YAML, and many more.

INPUT: JSON
[
  {
    "firstName": "John",
    "lastName": "Smith",
    "age": 45
  },
  {
    "firstName": "Jane",
    "lastName": "Doe",
    "age": 34
  }
]
DATAWEAVE SCRIPT
%dw 2.0
output csv
---
payload
OUTPUT: CSV
firstName,lastName,age
John,Smith,45
Jane,Doe,34
Open example in Playground

Easy data access

Navigate through your data in a structural way by combining DataWeave selectors. Values, keys, attributes, namespaces… no matter how nested, are just a query away.

INPUT: YAML
language: DataWeave
content:
  description: Transform data!
  resources:
    - Interactive Tutorial
    - Playground
    - VSCode extension
    - CLI
    - Community
DATAWEAVE SCRIPT
%dw 2.0
output json
---
payload.content.resources[0 to 1]
OUTPUT: JSON
[
  "Interactive Tutorial",
  "Playground"
]
Open example in Playground

Seamless data restructure

Leverage data from multiple sources to create a brand new structure of your own. Simply define your structure and combine multiple queries.

INPUT: XML
<order>
<product>
  <name>MuleSoft Connect</name>
</product>
<product>
  <name>Dreamforce</name>
</product>
<buyer>
  <name>Michael</name>
  <city>San Diego</city>
  <address>Koala Boulevard 314</address>
</buyer>
</order>
DATAWEAVE SCRIPT
%dw 2.0
output json
---
{
  tickets: payload.order.*product.name,
  deliverTo: {
    address: payload.order.buyer.address,
    city: payload.order.buyer.city
  }
}
OUTPUT: JSON
{
  "tickets": [
    "MuleSoft Connect",
    "Dreamforce"
  ],
  "deliverTo": {
    "address": "Koala Boulevard 314",
    "city": "San Diego"
  }
}
Open example in Playground

Powerful reshaping

Combine functions to completely reshape your data. Our standard library covers filtering, mapping, grouping, reducing, and many other common patterns.

INPUT: JSON
[
  {
    "dayOfWeek": "Friday",
    "event": "Develop mule application"
  },
  {
    "dayOfWeek": "Sunday",
    "event": "Breakfast @ Cafe"
  },
  {
    "dayOfWeek": "Friday",
    "event": "Football game"
  }
]
DATAWEAVE SCRIPT
%dw 2.0
output yaml
    
fun highlightTxt(text) = upper(text) ++ "!!"
---

payload
  groupBy ((item) -> item.dayOfWeek)
  mapObject ((value, key) -> 
    if(key ~= "Friday") 
      (key): value.event map highlightTxt($)
    else 
      (key): value.event
  )
OUTPUT: YAML
%YAML 1.2
---
Friday:
  - DEVELOP MULE APPLICATION!!
  - FOOTBALL GAME!!
Sunday:
  - Breakfast @ Cafe
Open example in Playground

Get Started

playground screen

Learn the fundamentals

Take a tour of the language and its key characteristics with our interactive tutorial. Learn about our selectors, operators, flow control, and functions while you test your knowledge and get instant feedback.

Go to tutorial
client screen

Execute in any terminal

Leverage our command-line interface to:

  • Query, filter, and map structured data from different sources like JSON, XML, CSV, and YAML.
  • Enhance your automations and pipelines with DataWeave scripts.
  • Create and push dynamic configuration files to other systems.
Go to CLI
vscode screen

Develop in VS Code

Code away with our Visual Studio Code extension. Design, test, debug, and publish DataWeave scripts with autocompletion, refactors, quick fixes, and live previews.

Install extension

What's New?

Join our community

stackoverflow logo slack logo github logo