I want to append --EOF at the end of file in CSV after transforming JSON to CSV in Mule Data Weave 2.0
{ "serialNumber": "ABCD", "asset": "EFGH" }
ABCD|EFGH
--EOF
Use the write() function to write the output as a string so you can concatenate it to the EOF string that you want.
Example:
%dw 2.0 output text/plain --- write(payload, "application/csv", {"header":false, "separator" : "|"}) ++ "\n--EOF"