How do you parse a CSV without a header in DataWeave 2.0?
I have the following CSV:
Chris,Doe,Student
Bob,Smith,Teacher
and am trying to merely convert it to JSON like this:
[
[ "Chris", "Doe", "Student" ],
[ "Bob", "Smith", "Teacher" ]
]
or even this:
[
{"0": "Chris", "1": "Doe", "2": "Student" },
{"0": "Bob", "1": "Smith", "2": "Teacher" }
]
Here's my DataWeave:
%dw 2.0
input payload application/csv header=false
output application/json
---
payload
But this is the payload being returned from the DW script:
[
{
"Chris": "Bob",
"Doe": "Smith",
"Student": "Teacher"
}
]
I've tried messing around with the metadata, specifying CSV metadata type that include/exclude headers, but no luck.