Reputation: 13
Input:-
[
{
"appName": "helloworld-1"
},
{
"appName": "helloworld-2"
}
]
Expected Output
{
"appList": [ "helloworld-1" , "helloworld-2" ]
}
Can anyone guide me for data weave script for this ?
Upvotes: 0
Views: 1786
Reputation: 126
According to the DataWeave Documentation, you can apply the multi value selector. Multi value selector returns an array with all the values whose key matches the expression.
%dw 1.0
%output application/json
---
{
appList : payload.*appName
}
Upvotes: 0