'Mule 4: map json to xml payload dataweave 2.0
I have a json payload in Mule that I am trying to convert to xml. Whatever value is in "entity_id" should be the "payment_id" in my output. Also whatever value comes for the key "selected_payment_option" should be "method" in my output.
Please see my sample input here:
{
"items": [
{
"payment": {
"entity_id": 1485222,
"method": "m2_kp"
},
"extension_attributes": {
"payment_addition_info":[
{
"key": "m1_code",
"value": "over_time"
},
{
"key": "order_id",
"value": "4f86-2cce-4870-ad05-089a333"
},
{
"key": "selected_payment_option",
"value": "slice_by_card"
}
]
}
}
]
}
And my desired output for this would be
<root>
<payment>
<payment_id>1485222</payment_id>
<method>slice_by_card</method>
</payment>
</root>
Any help would be greatly appreciated. Thank you!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
