【发布时间】:2011-10-04 19:28:03
【问题描述】:
我正在尝试解析来自 MongoDB 云服务器的数据。我从服务器返回的JSON数据如下:
[
{
"_id": {
"$oid": "4e78eb48737d445c00c8826b"
},
"message": "cmon",
"type": 1,
"loc": {
"longitude": -75.65530921666667,
"latitude": 41.407904566666666
},
"title": "test"
},
{
"_id": {
"$oid": "4e7923cb737d445c00c88289"
},
"message": "yo",
"type": 4,
"loc": {
"longitude": -75.65541383333333,
"latitude": 41.407908883333334
},
"title": "wtf"
},
{
"_id": {
"$oid": "4e79474f737d445c00c882b2"
},
"message": "hxnxjx",
"type": 4,
"loc": {
"longitude": -75.65555572509766,
"latitude": 41.41263961791992
},
"title": "test cell"
}
]
我遇到的问题是返回的数据结构不包含 JSON 对象数组的名称。返回的每个对象都是一个“帖子”。但是,如果 JSON 对象数组没有名称,我如何使用 GSON 解析它。我想将这些“帖子”放入 Post 类型的 ArrayList 中。
【问题讨论】:
标签: android json parsing mongodb gson