在Android上解析JSON最好的库是什么?我知道Android框架内置了一个JSON库,我也听说过gson.但我想知道是否有人比较过Android上的各种JSON选项,并提出了 Select 其中一种而不是另一种的理由.我认为性能和可用性是主要标准.
在Android上解析JSON最好的库是什么?我知道Android框架内置了一个JSON库,我也听说过gson.但我想知道是否有人比较过Android上的各种JSON选项,并提出了 Select 其中一种而不是另一种的理由.我认为性能和可用性是主要标准.
While there is a handful of Java-to/from-JSON APIs that provide for easy (basic) binding between JSON and an arbitrary Java data structure, Jackson and Gson are by far the most sophisticated (capable) and feature-rich options.
早在2011年7月,我在我的博客上发布了一个多部分的系列文章,比较了使用Gson和Jackson的情况,详细介绍了Gson用户指南中组织的功能,包括在Jackson中可比较的实现示例(以及Gson中的实现示例,其中Gson用户指南不完整或不完整).
The sixth part of the series provides easy navigation links for the comparison, as well as a summary comparison listing. http://programmerbruce.blogspot.com/2011/07/gson-v-jackson-part-6.html
This is the most comprehensive comparison of using Gson versus Jackson for common JSON-to/from-Java tasks known.
如前所述,各种Java与JSON API之间的性能比较以https://github.com/eishay/jvm-serializers/wiki分的价格提供.Gson(2.0)的当前版本在序列化和反序列化500字节JSON struct 方面比Jackson(1.9.2)的当前版本慢大约16倍,使用了非常类似的实现工作(只有一两行代码).
Martin Adamek发布了Android上运行的各种API在http://martinadamek.com/2011/01/31/comparison-of-json-parsers-performance-on-android/和http://martinadamek.com/2011/02/04/json-parsers-performance-on-android-with-warmup-and-multiple-iterations/上的一些性能结果