AndroidスタジオでJSON APIを使用する際に問題が発生しています 多くの例について見ていますが、必要なデータを抽出する方法がまだわかりません以下の内容AndroidスタジオのJson解析の問題
JSONObject subObj = jsonObject.getJSONObject("response");
:
{
"hereNow": {
"count": 1,
"items": [
{
"id": "xxxxxxxxxx",
"createdAt": xxxxxxxxxx,
"type": "checkin",
"timeZoneOffset": 60,
"user": {
"id": "xxxxxxx",
"firstName": "xxxxxxxx",
"lastName": "xxxxxxxxxx",
"gender": "male",
"relationship": "friend",
"photo": {
"prefix": "xxxxxxxxx",
"suffix": "xxxxxxxxxx"
}
},
"likes": {
"count": 0,
"groups": [
]
},
"like": false
}
]
}
}
のTh ...
は、いくつかの時間後、私は最終的にポイントを得ているが、私は抽出するために考え出しました現在の問題は次のとおりです。ユーザーオブジェクトの抽出方法私は
JSONObject
と
JSONArray
で多くのことをしようとしてきた。しかし、私はこれを取得し続ける:
Attempt to invoke virtual method 'org.json.JSONArray org.json.JSONObject.getJSONArray(java.lang.String)' on a null object reference
誰かが私を助けてくださいことはできますか? 一般的に私はJSONを理解しているので、私は別のトピックにリダイレクトしないでください。この特定のケースではありません。
ありがとうございます。
例を試してみて、[ここでの説明](http://stackoverflow.com/questions/5015844/parsing-json-object-in-java/40828056#を読むに動作するはずです40828056)、読んだ後に疑問がある場合は質問を更新してください –