0
votes

I am trying to get rows from database and send the response in "CSV" format. This is the transform component right after database select

%dw 2.0
output application/csv
---
payload map {
name : $.NAME,
id: $.Num,
age: $.age
}

When I hit the API using postman/soapUI, I get response as json, not csv.

1
This transformation seems ok. You should review your entire app to see if you have any JSON transformations on the way. In particular, you should check that the response components of any HTTP listeners are not transforming the data.afelisatti
If you are using Anypoint Studio, you can use the debugger to see the payload flowing and where is it converted to JSON, if it's something wrong on the app. It's also helpful to switch the org.mule.service.http logger to DEBUG inside the log4j2.xml file so you can see what is the real API response on the logs.Jorge Garcia

1 Answers

1
votes

Something like this maybe? List> converted to CSV (assuming you were issuing a select from the DB)

enter image description here