简体   繁体   English

将JSON对象的列表转换为Mule DataWeave上的单个列表

[英]Convert list of JSON Object to single list on Mule DataWeave

Input:- 输入:

[
  {
    "appName": "helloworld-1"
  },
  {
    "appName": "helloworld-2"
  }
]

Expected Output 预期产量

{
"appList": [ "helloworld-1" , "helloworld-2" ]
}

Can anyone guide me for data weave script for this ? 谁能为此指导我制作数据编织脚本?

According to the DataWeave Documentation , you can apply the multi value selector. 根据DataWeave文档 ,您可以应用多值选择器。 Multi value selector returns an array with all the values whose key matches the expression. 多值选择器返回一个数组,该数组包含其键与表达式匹配的所有值。

%dw 1.0
%output application/json
---
{
    appList : payload.*appName
}

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

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