如何将数组分配给字符串?我想将 XML 转换为 CSV。我的数据编织返回数组。我想将其转换为 CSV。
转换消息代码:
%input payload application/xml
%output application/java
---
(payload.catalog.*category-assignment default []) groupBy $.@product-id pluck {
product-id:$$,
cat-id: $.@category-id joinBy ":",
primary-flag:$.primary-flag,
field3:$.@category-id when $.primary-flag[0] == "true" otherwise ""
}
我的有效载荷是这样的:
[{
product - id = D198561, cat - id = 1111, primary - flag = null, field3 =
}, {
product - id = D198563, cat - id = 30033, primary - flag = [true], field3 = [30033]
}, {
product - id = D198566, cat - id = 0933: 2104: 7043, primary - flag = null, field3 =
}]
我希望关于有效负载的 CSV 输出为:
Field1: product-id, Field2:cat-id,Field3:field3
它在字段 3 中给出错误,因为它是像 field3=[30033] 这样的数组。
提前致谢