0
votes

Without datamapper , how to convert csv file into json in mule. Because The DataMapper transformer works only in the Mule Studio Enterprise edition.

<flow name="filterindatamapperFlow2" doc:name="filterindatamapperFlow2">
    <file:inbound-endpoint path="/tmp/inbox" doc:name="Inbound file"/>
    <data-mapper:transform config-ref="CSV_To_UnfilteredJSON" doc:name="CSV To Unfiltered JSON"/>
    <request-reply>
        <vm:outbound-endpoint path="splittandprocess" exchange-pattern="one-way"/>
        <vm:inbound-endpoint path="result"/>
    </request-reply>
    <json:object-to-json-transformer doc:name="Object to JSON"/>
    <file:outbound-endpoint path="/tmp/outbox" doc:name="Outbound file"/>
</flow>
2

2 Answers

0
votes

This link might help you :How to read CSV file and insert data into PostgreSQL using Mule ESB, Mule Studio follow the steps and extract all the value from CSV files and then create you JSON using Expression in Mule

0
votes

It very much depends on the kind of data that you're working with. If your data isn't too complicated, then I would suggest simply parsing the CSV and building a number of POJOs (or Maps) that represent the JSON you want to work with.

Having said that, I highly suggest that you look at Smooks. It's an extremely powerful data mapper that works with both Mule EE and CE. Even if your data is large, it's able to stream your data so that your VM doesn't run out of memory.