简体   繁体   English

Mule(Dataweave)将Json数据转换为List <Map>

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

I have this Json Data I want to 我有这个想要的Json数据

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

From this I want to Map path and name to List<Map> application/java 从这里我想将路径和名称List<Map>List<Map> application / java

{
 name :
 path :
}

You just need to use the map operator for mapping all the elements 您只需要使用map运算符来映射所有元素

%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" 请注意,您使用$访问每个元素的值,地图运算符也收到了元素列表“ payload.universes”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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