Dataweave 2.0 update function
Update the user data below. Usernames should be all lower case and the street should be "Fiskargatan" (example from dataweave tutorial from mulesoft)
Input payload
{
"username": "WASP",
"name": "Lisbeth",
"surname": "Salander",
"location": {
"address": {
"street": "Lundagatan",
"number": 9
},
"city": "Stockholm",
"country": "Sweden"
}
}
Dataweave Transformation
%dw 2.0import * from dw::util::Valuesoutput json---payload update "username" with lower($) update["location", "address", field("street")] with "Fiskargatan"
output
{ "username": "wasp", "name": "Lisbeth", "surname": "Salander", "location": { "address": { "street": "Fiskargatan", "number": 9 }, "city": "Stockholm", "country": "Sweden" }}
Screenshot
.
Comments
Post a Comment