In the following Mule app flow, the Logger uses payload.^encoding to select the encoding of "my string"`set in the Set Payload (`set-payload) component.
Returns the class of the Plain Old Java Object (POJO). The value might result from calling a method in a Java class or have a data type (such as String or DateTime) that DataWeave treats as a Java value.
In the following Mule app flow, the Logger uses payload.^contentLength to select the length of the string my string, set in the Set Payload (set-payload) component.
Returns the value of specified metadata for a Mule payload, variable, or attribute.
myKey[?($ == "aValue")] returns only the values of matching keys within an array or object. Note that ? is also used in Key Present Validator. If no key-value pairs match, the result is null.
You can check for the presence of a given key. ! evaluates the selection and fails with an exception message if the key is not present. ? returns true if the selected key is present, false if not. Note that ? is also used in Filter Selectors (myKey[?($ == "aValue")]).
# returns the XML namespace of a selected key as plain text.
Using .@ without the key name returns an object containing the attributes as key-value pairs.
If you need multiple sequential values from an Array, DataWeave allows you to select a range of values with the range selector ([n to m]).
The index selector returns the element at the specified position. It can be applied over an array, object, or string.