将字符串数组转换为csv mulesoft 4.1.2

时间:2018-08-29 15:45:50

标签: mule dataweave

我有一个字符串数组,想要将其转换为mule 4.1.2中的csv输出。输入有效负载示例如下-

[“ {\ n” id“:123,\ n” name“:” ABC“,\ n” communication“:” email“ \ n}”,“ {\ n” id“:123,\ n “ name”:“ ABC”,\ n“ communication”:“ paper” \ n}“]

我需要csv输出的列为

MemberId人名交流 123个ABC电子邮件

1 个答案:

答案 0 :(得分:0)

使用DataWeave相当简单

%dw 2.0
output application/csv headerLineNumber = 0 , header = true
---
payload map ( payload01 , indexOfPayload01 ) -> {
    MemberId: payload01.id as String,
    "Person Name": payload01.name,
    Communication: payload01.communication
}