John Sylvester
John Sylvester

Reputation: 257

How do I convert a file from one format to any other in java?

Is there any java utility or library available that can help me convert file data in CSV, JSON or XML to any other type.

e.g:

CSV -> JSON
CSV -> XML
JSON -> CSV
JSON -> XML
XML -> CSV
XML -> JSON

Any idea how I can go about this? File size will be a minimum of 100mb so looking at the most process efficient solution.

Upvotes: 0

Views: 1305

Answers (2)

Jaiprakash
Jaiprakash

Reputation: 609

FasterXML (Jackson) has the support to read and write to CSV,XML and JSON.

If the format of the data is fixed, it could be read into Java objects, and then output for the different type could be generated by defining annotations

Else, a generic solution mentioned by Programmer Bruce at Parsing XML into JSON could be used.

Upvotes: 1

David Findlay
David Findlay

Reputation: 1356

Jackson is a good solution for this. See https://github.com/FasterXML/jackson

Upvotes: 1

Related Questions