Converting an CSV file to a JSON object in Java

前端 未结 9 1679
太阳男子
太阳男子 2020-12-05 21:47

Is there an open source java library to convert a CSV (or XLS) file to a JSON object?

I tried using json.cdl, but somehow it does not seem to work for large CSV stri

9条回答
  •  失恋的感觉
    2020-12-05 22:37

    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.

    http://opencsv.sourceforge.net/#javabean-integration

    http://jaxb.java.net/guide/Mapping_your_favorite_class.html

提交回复
热议问题