Search code examples
jsoncsvwso2wso2-enterprise-integratorwso2-integration-studio

How can I read csv data from a file and convert into json using CSV-connector in wso2 Integration studio?


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?


Solution

  • 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.