我有这样的回应:
[ { "key": { "kind": "UserRecord", "id": 0, "name": "1" }, "firstName": "1", "lastName": "1", "homeLat": 0.0, "homeLon": 0.0, "workLat": 0.0, "workLon": 0.0, "currentLat": 10.0, "currentLon": 10.82, "timestamp": 1335735046606, "score": 0, "isStarred": false, "distance": 0.0 }, { "key": { "kind": "UserRecord", "id": 0, "name": "32423542324234324" }, "firstName": "Simone", "lastName": "Boscolo Berto", "homeLat": 0.0, "homeLon": 0.0, "workLat": 0.0, "workLon": 0.0, "currentLat": 55.786444, "currentLon": 12.515867, "timestamp": 1335884083696, "score": 0, "isStarred": false, "distance": 0.0 } ]
以及从每个 JSONObject 中获取我的对象的方法
private User getUserFromJson(JSONObject jsonUser)
如何在 JSONObjects 列表中进行迭代?我应该使用 JSONArrayobject 吗?