%dw 2.0
output application/json
import * from dw::util::Values
---
[{name: "Peter Parker", password: "spiderman"}, {name: "Bruce Wayne", password: "batman"}] mask field("password") with "*****"
mask
DataWeave 2.2 is compatible and bundled with Mule 4.2. This version of Mule reached its End of Life on May 2, 2023, when Extended Support ended. Deployments of new applications to CloudHub that use this version of Mule are no longer allowed. Only in-place updates to applications are permitted. MuleSoft recommends that you upgrade to the latest version of Mule 4 that is in Standard Support so that your applications run with the latest fixes and security enhancements. |
mask(Null, String | Number | PathElement): Any
Helper function that makes mask
work correctly with null
.
mask(Any, PathElement): Any
This mask
function replaces all simple elements that match the specified
criteria.
Simple elements do not have child elements and cannot be objects or arrays.
Parameters
Name | Description |
---|---|
|
A value to use for masking. The value can be any DataWeave type. |
|
The |
Example
This example shows how to mask the value of a password
field in
an array of objects. It uses field("password")
to return the PathElement
that it passes to mask
. It uses with ""
to specify the value
() to use for masking.
mask(Any, String): Any
This mask
function selects a field by its name.
Parameters
Name | Description |
---|---|
|
The value to use for masking. The value can be any DataWeave type. |
|
A string that specifies the name of the field to mask. |
Example
This example shows how to perform masking using the name of a field in the input. It modifies the values of all fields with that value.