Mule Concepts
DataWeave IV
• Regardless of the input and output types, the data model for the output is
always described in standard DataWeave code.
• It is this model that the input is transformed into.
• The data model of the produced output could consist of three different
types of data:
– Simple Values
– Arrays: Represented as a sequence of comma separated values
– Objects: Represented as collection of key value pairs
• When you write code in the DataWeave body, you define an expression
that generates one of the data types listed above.
• Expressions can also be complex, meaning that they can be composed of
other expressions.
• Remember that each expression produces an Object, an Array, or a
Variable
DataWeave – Body
• Simple Values :
– Simple values can be of the following types:
• String : Double quoted ("Hello") or Single quoted ('Hello')
• Boolean : Literals true or false.
• Number : Decimal and Integer values are supported (ex: 2.0).
• Date : IS0-8601 enclosed by "|" (ex:|2003-10-01T23:57:59Z|).
• Regex : Regex expression enclosed by "/" (ex:/(d+)-(d+)/)
• Arrays :
– Arrays are represented as a sequence of value expressions.
– Example :
%dw 1.0 %output application/json --- [ "My", "three", "words" ]
• Objects :
– These are represented as a comma separated sequence of key: value pairs
surrounded by curly brackets { }.
DataWeave – Body
• Objects :
– Example :
– Both the keys and the values may be expressions.
DataWeave – Body
Transform Output
%dw 1.0
%output application/xml
---
myoutput:{
name : "Jill",
payload : payload.id + 3
}
<?xml version="1.0"
encoding="UTF-8"?>
<myoutput>
<name>Jill</name>
<payload>5</payload>
</myoutput>

Mule data weave_4

  • 1.
  • 2.
    • Regardless ofthe input and output types, the data model for the output is always described in standard DataWeave code. • It is this model that the input is transformed into. • The data model of the produced output could consist of three different types of data: – Simple Values – Arrays: Represented as a sequence of comma separated values – Objects: Represented as collection of key value pairs • When you write code in the DataWeave body, you define an expression that generates one of the data types listed above. • Expressions can also be complex, meaning that they can be composed of other expressions. • Remember that each expression produces an Object, an Array, or a Variable DataWeave – Body
  • 3.
    • Simple Values: – Simple values can be of the following types: • String : Double quoted ("Hello") or Single quoted ('Hello') • Boolean : Literals true or false. • Number : Decimal and Integer values are supported (ex: 2.0). • Date : IS0-8601 enclosed by "|" (ex:|2003-10-01T23:57:59Z|). • Regex : Regex expression enclosed by "/" (ex:/(d+)-(d+)/) • Arrays : – Arrays are represented as a sequence of value expressions. – Example : %dw 1.0 %output application/json --- [ "My", "three", "words" ] • Objects : – These are represented as a comma separated sequence of key: value pairs surrounded by curly brackets { }. DataWeave – Body
  • 4.
    • Objects : –Example : – Both the keys and the values may be expressions. DataWeave – Body Transform Output %dw 1.0 %output application/xml --- myoutput:{ name : "Jill", payload : payload.id + 3 } <?xml version="1.0" encoding="UTF-8"?> <myoutput> <name>Jill</name> <payload>5</payload> </myoutput>