【发布时间】:2017-10-17 18:02:57
【问题描述】:
我正在使用 Mule ESB,我需要使用 JSON1 中的 ItemID 和 JSON2 中的 qty,然后创建一个新的 JSON 有效负载。
这是 JSON 1:
[{
"itemid": "160544",
"sku": "L45-075-14",
"qty": "1.0000"
}, {
"itemid": "160545",
"sku": "063-0159-881",
"qty": "1.0000"
}]
这是 JSON 2:
[{
"sku": "603-0159-881",
"qty": "4.0000"
}, {
"sku": "L45-075-14",
"qty": "5.0000"
}]
这是我的数据编织代码:
%dw 1.0
%output application/java
---
flowVars.SSRGetOrderItems map (action, index) -> {
(action.itemid) : action.qty,
(flowVars.SSRCreateStarshipItems filter $.sku == action.sku)
}
我不需要最终 Java 列表中的 SKU,我只需要在 sku 键上加入的 itemid 和 qty。 (请参阅下面的所需输出)
期望的输出:
[{"160544"-"5.0000"}, {"160545"-"4.0000"}]
【问题讨论】: