简体   繁体   English

如何使用dataweave ule子从列表中删除特定字段

[英]how to remove specific fields from List maps using dataweave mule

how to remove specific fields from Array maps using dataweave without iterating the array 如何在不迭代数组的情况下使用dataweave从数组映射中删除特定字段

Input: 输入:

[{a:1,b:2,c:3,d:4},{a:5,b:6,c:7,d:8}]

I want to remove c and d fields from array(c and d values are dynamic) 我想从数组中删除c和d字段(c和d的值是动态的)

output: 输出:

[{a:1,b:2},{a:5,b:6}]

How can we do it in data weave 我们如何在数据编织中做到这一点

%dw 1.0
%output application/json
---
[{a:1,b:2,c:3,d:4},{a:5,b:6,c:7,d:8}] map 
$ - "c" - "d" 

I used your input inline so it could run easily. 我使用了内联输入,因此可以轻松运行。 When adding to a flow replace it with "payload". 当添加到流中时,将其替换为“有效负载”。

Combination of minus and map is the correct opproach. 减号和地图的组合是正确的方法。 Map operator does iterate through array. Map运算符会遍历数组。

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

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