当前位置: 动力学知识库 > 问答 > 编程问答 >

mule datamapper convert csv into json

问题描述:

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>

网友答案:

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

网友答案:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: