Also Read: How to use contains operation in Object Store Mule 4

How to verify if a string value is present in an ArrayList using Mule Dataweave?
In the below example, We are trying to verify if the input payload contains "skillsList" as a key and populate the entire "skillsList" object as JSON output.

Dataweave code:
%dw 2.0
output application/json
var keys=keysOf(payload.users)
---
if ((sizeOf((keys)filter ($ contains "skillsList")) > 0) == true)
"skillsList":payload.users.skillsList
else ""
0 Comments