Use Case One
Input
{
"medication": {
"name": "Natrecor"
},
"genericequivalents": [
{
"name": "Narecor",
"label": "Erlotinib2"
}
]
}
DW Code
%dw 1.0
%output application/xml
---
response: {
medication : payload.medication,
genericequivalents: {
(payload.genericequivalents map {
names : {
label: $.label,
name: $.name
}
})
}
}
Use Case Two
Input
{
"medication": "praxel",
"genericequivalents": {
"name": [
"Praxe",
"Praxedes",
"Paxel",
"Pragel",
"Fraxel",
"Parexel"
]
}
}
DW Code
%dw 1.0
%output application/xml
---
{
response: {
medication: payload.medication,
genericequivalents: {
(payload.genericequivalents.name map ((name , indexOfName) -> {
name: name
}))
}
}
}
Output
praxel
Praxe
Praxedes
Paxel
Pragel
Fraxel
Parexel
I am really enjoying reading your well written articles. It looks like you spend a lot of effort and time on your blog. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work..
ReplyDeleteMulesoft online training bangalore
Thank you for sharing .The data that you provided in the blog is informative and effective.mulesoft training in bangalore
ReplyDelete