简体   繁体   中英

Mule (Dataweave) transform Json data to List<Map>

I have this Json Data I want to

{"universes":[{"path":"Universes/demo","name":"eFashion"},{"path":"Universes","name":"Cool"}]}

From this I want to Map path and name to List<Map> application/java

{
 name :
 path :
}

You just need to use the map operator for mapping all the elements

%dw 1.0
%output application/java
---
payload.universes map {
    path: $.path,
    name: $.name
}

Notice that you access the value for each element using $, also the map operator receive the list of elements "payload.universes"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM