unble to convert xml to json array in dataweave 2.0
output :
"employees":{
"employee":{
"name" : "abc"
},
"employee":{
"name" : "xyz"
}
}
expected output :
"employees":{
"employee" : [
{ "name" : "abc" },
{ "name" : "xyz" }
]
dataweave script :
%dw 2.0
output application/json
---
payload
5 answers
Hi @tejakkk ,
Could you try using next?
%dw 2.0
output application/java
---
{"employees":{
"employee":
(payload.employees.*employee map{
"name":$.name
} )
}
}
I hope the above helps! If you have any doubt do not hesitate to contact me.
Regards,
Arianna Flores