My sample input payload is given below:
{
"entities": [
{
"Id": "ab5fdd89e123",
"target": {
"Data": {
"attributes": {
"Name": [],
"Address": [
{
"value": {
"AddType": [{"value": "MAIN"}],
"Flag": [{"value": true }]
}
}]}}}}]}
I need to replace the attribute called Flag (target.Data.attributes.Address.value.Flag) to "PrimaryFlag" with value as true. I also need to add a new attribute after that called "Code" with value as null. The desired output should be as below:
{
"entities": [
{
"Id": "ab5fdd89e123",
"target": {
"Data": {
"attributes": {
"Name": [],
"Address": [
{
"value": {
"AddType": [{"value": "MAIN"}],
"PrimaryFlag": [{"value": true }],
"Code": [{"value": null}]
}
}]}}}}]}
I'm running Mule 3.9 and is on dataweave 1.0