Getting started Community Training Tutorials Documentation APIs, AI & Tools
%dw 1.0
%output application/xml nullValueOn="none"
---
payload
DataWeave 2 is largely unchanged from DataWeave 1. However, MuleSoft made many improvements to make it easier to learn and added new capabilities.
In DataWeave 2, all operators are now functions. While this can involve more parentheses, it is less ambiguous and more friendly to learn through auto-completion features. The previous syntax continues to work for functions with two parameters, providing a shorter syntax for power users.
DataWeave 1 |
|
|
DataWeave 2 - Function Syntax |
|
|
DataWeave 2 - Shortcut Syntax |
|
DataWeave 2 uses a type name syntax, which removes the : from the name.
DataWeave 1 |
|
|
DataWeave 2 |
|
The default for the reader property nullValueOn is empty for DataWeave 2.0.
For DataWeave 1.0 (which is compatible with Mule 3.x), the value is none, for example:
%dw 1.0
%output application/xml nullValueOn="none"
---
payload
<book>
<name></name>
</book>
<book/>