Types, Variables & Core Operators
DataWeave is a strongly typed, expression-oriented language. Everything is an expression that returns a value.
DataWeave supports String, Number, Boolean, Date, DateTime, Object, Array, Null, and Binary types. All types are immutable — transformation always produces new values.
Variables declared with `var` are immutable bindings. Functions are first-class values. The `->` syntax defines anonymous functions (lambdas).
The `++` operator concatenates strings, arrays, and objects. The `update` operator creates a modified copy of an object without mutation.
%dw 2.0
output application/json
var today = now() as Date
var greeting = "Hello, " ++ payload.name ++ "!"
var taxRate = 0.08 as Number
---
{
message: greeting,
reportDate: today as String { format: "yyyy-MM-dd" },
netAmount: payload.amount,
tax: (payload.amount * taxRate) as Number { format: "0.00" },
total: (payload.amount * (1 + taxRate)) as Number { format: "0.00" }
}