Is there an open source java library to convert a CSV (or XLS) file to a JSON object? I tried using json.cdl (http://bethecoder.com/applications/tutorials/json/json-java/csv-to-jsonarray.html) but somehow it does not seem to work for large CSS strings. I'm trying to find something like http://www.cparker15.com/code/utilities/csv-to-json/, but written in java. Any help is appreciated. Thanks!
Tell me more
×
Stack Overflow is a question and answer site for
professional and enthusiast programmers. It's 100% free, no registration required.
|
You can use Open CSV to map CSV to a Java Bean, and then use JAXB to convert the Java Bean into a JSON object. |
|||
|
If your CSV is simple, then this is easy to write by hand - but CSV can include nasty edge cases with quoting, missing values, etc.
You might want to use a CSV library, then convert to JSON 'by hand' |
|||
|