Update individual fields in object using Dataweave in Mule 4
Jan 15, 2021
The following code snippet helps to modify individual fields in a object.
Input:
[{
"id": "111",
"name": "Ernie",
"address": "Hulo"
}, {
"id": "112",
"name": "John",
"address": "Huawei",
"email": "b@a.com"
}]
Output:
[{
"id": "111",
"name": "Ernie",
"address": "Hulo",
"email": "a@a.com"
},
{
"id": "112",
"name": "John",
"address": "Huawei",
"email": "b@a.com"
}]
Below image shows the dataweave code to achieve above output using update operator.
Below is the dataweave code.