在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/上的一些性能结果

Json相关问答推荐

如何在JMESPath中区分空和假?

使用Jolt变换转换JsonArray以将关键字转移到内部JsonArray中

从JSON格式提取数据时分隔通用名称

如何在Gatsby/Reaction中获取JSON-File子 node

NiFi QueryRecord处理器- Select 可选的JSON属性

无法从MongoDB集合中检索正确的文档

如何在JSONata对象中迭代并向数组添加新字段?

递归解码嵌套列表(具有任意深度的列表列表)

XSLT 3.0 Json-to-xml,json 包含 html struct

报告重复的对象键

Rust实现:高效解析任意大小的JSON数组

将JSON行转换为TSV格式, for each 数组项生成单独的行

使用 Jolt 变换将平面 json 转换为具有多个数组的嵌套 Json

在 Flutter 中将对象转换为可编码对象失败

当值包含ansible中的字符串时解析json值

如何解决名为 null 的map值

避免 KeyError 的默认字典键

Laravel5 Json 获取文件内容

jQuery.getJSON 和 jQuery.parseJSON 返回 [object Object]?

如何将单引号转义成双引号转成单引号