我想解析这样的 json 结构:
{"response":
{
"arr1":[count,{...}],
"arr2":[count,{...}]
}
}
如果 count 有键“count”(例如),则一切正常。但钥匙是空白的。有什么方法可以映射此结构并仅手动检索此值,或者我需要自己在没有 gson 的情况下解析所有这些 json ?
UPDATED
这是一个有效的 json(通过检查http://jsonlint.com/ http://jsonlint.com/)
{
"response": {
"arr1": [
615,
{
"body": "hi",
"title": "Re(2): ..."
},
{
"body": "hello",
"title": "Re(23): ..."
}
],
"arr2": [
132,
{
"body": "hi",
"title": "Re(2): ..."
},
{
"body": "hello",
"title": "Re(23): ..."
}
]
}
}
如果你想解析任意集合,你应该阅读序列化和反序列化具有任意类型对象的集合 http://sites.google.com/site/gson/gson-user-guide#TOC-Serializing-and-Deserializing-Collection-with-Objects-of-Arbitrary-Types并查看示例代码示例代码 http://code.google.com/p/google-gson/source/browse/trunk/extras/src/main/java/com/google/gson/extras/examples/rawcollections/RawCollectionsExample.java.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)