I have the input json like this:
{
"person": {
"personinfo": [
{
"VAR_KEY": "name",
"VAR_VAL": "jack"
},
{
"VAR_KEY": "sex",
"VAR_VAL": "male"
}
]
}
}
and I want to get the output like this
{
"person": {
"personinfo": [
{
"name":"jack"
},
{
"sex":"male"
}
]
}
}
how to write the mule esb dw script? thank you
this works for me
%dw 1.0
%output application/json
---
person : {
personinfo : payload.person.personinfo map {
($.VAR_KEY) : $.VAR_VAL
}}