I am trying to transform a list of objects to csv using the following code in dataweave:
%dw 1.0
%type company = :object {class: "java.util.ArrayList"}
%input payload application/java
%output application/csv
---
{
name: payload.name,
address: payload.address
} as :company
The below is the output that I get when I execute the above data weave code.
name,name
testName,testName2
testAddress,testAddress2
whilst I am expecting the following: (Sample data)
name,address
testName,testAddress
testName2,testAddress2
Help me understand to what am I missing in the data weave component