I have two input payloads and I want to combine a JSON object inside another nested JSON object to a specific object. The expected output is to combine Input 2 with Input 1 under "Response_Data".
I tried but I could combine Input 2 at the end but not able to add it to the "Response_Data".
Can someone help me write the dataweave code?
Input 1:
[{
"Org_Response": {
"Request_Criteria": {
"Org_Type_Reference": {
"ID": {
"type": "Org_Type",
"text": "Business_Unit"
}
},
"Include_Inactive": "0"
},
**"Response_Data"**: {
"Org": {
"Reference": {
"ID": {
"type": "Business_Unit_Reference_ID",
"text": "999-99-FD"
}
},
"Org_Data": {
"Reference_ID": "999-99-FD",
"Name": "Management"
}
}
}
}
}]
Input 2:
{
"Org": {
"Reference": {
"ID": {
"type": "Business_Unit_Reference_ID",
"text": "90000"
}
},
"Org_Data": {
"Reference_ID": "90000",
"Name": "TAXES"
}
}
}
Expected Output:
[{
"Org_Response": {
"Request_Criteria": {
"Org_Type_Reference": {
"ID": {
"type": "Org_Type",
"text": "Business_Unit"
}
},
"Include_Inactive": "0"
},
**"Response_Data"**: {
"Org": {
"Reference": {
"ID": {
"type": "Business_Unit_Reference_ID",
"text": "999-99-FD"
}
},
"Org_Data": {
"Reference_ID": "999-99-FD",
"Name": "Management"
}
},
"Org": {
"Reference": {
"ID": {
"type": "Business_Unit_Reference_ID",
"text": "90000"
}
},
"Org_Data": {
"Reference_ID": "90000",
"Name": "TAXES"
}
}
}
}
}]
Thanks in advance