输入:{ “ID”: [ 1,2,3,4,5,6,7,8,9,10 ] }
输出:{ “ID”: [ “ 1,2,3”, “ 4,5,6”, “ 7,8,9”, “ 10” ] }
%dw 2.0
output application/json
---
"id": vars.pd.*id joinBy ","
答案 0 :(得分:2)
您可以在divideBy
模块中使用dw::core::Arrays
功能。
%dw 2.0
import * from dw::core::Arrays
output application/json
---
"id": payload.id divideBy 3 map ((v) -> v joinBy ",")