如何将文件从一种格式转换为java中的任何其他格式? [英] How do I convert a file from one format to any other in java?

查看:112
本文介绍了如何将文件从一种格式转换为java中的任何其他格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有任何可以帮助我将CSV,JSON或XML中的文件数据转换为任何其他类型的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.

例如:

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

任何想法我怎么可以这样做? 。文件大小将是最低100MB,所以在看大多数工艺有效的解决方案。

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

推荐答案

FasterXML(杰克逊)具有读取和写入到CSV,XML和JSON的支持。

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

如果数据的格式是固定的,它可以读入Java对象,然后通过定义注释

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

否则,程序员Bruce在将XML解析为JSON

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

这篇关于如何将文件从一种格式转换为java中的任何其他格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆