I am trying to read csv data from a file and convert it into json data by using the CSV-Connector in WSO2 Integration studio. The data is converted to json when I pass it as payload, but how do I do it when I want to read csv data from a file by using the Connector? What extra connectors or mediators might be required for the same?
CodePudding user response:
You can use WSO2 File connector https://docs.wso2.com/display/ESBCONNECTORS/Working with the File Connector
https://docs.wso2.com/display/ESBCONNECTORS/File Connector
or you can write new custom mediator https://docs.wso2.com/display/EI660/Class Mediator with your logic.
CodePudding user response:
First, you need to read the file using the File Connector or using the VFS transport. (Either use a VFS Listener proxy or a File Inbound Endpoint). There is a File Inbound sample on the getting started page in the Integration Studio
.
After reading the file youcan use the CSV-Connector
, Datamapper Mediator
or use the Smooks Mediator to convert the CSV into a XML and then to a JSON.