基本的に、アンドロイドでは、手動で、またはサードパーティのライブラリを使用してJSON応答を解析する必要があります。
あなたはJSONレスポンスを持っている場合は、次のように:
{
"pageInfo": {
"pageName": "abc",
"pagePic": "http://example.com/content.jpg"
}
"posts": [
{
"post_id": "123456789012_123456789012",
"actor_id": "1234567890",
"picOfPersonWhoPosted": "http://example.com/photo.jpg",
"nameOfPersonWhoPosted": "Jane Doe",
"message": "Sounds cool. Can't wait to see it!",
"likesCount": "2",
"comments": [],
"timeOfPost": "1234567890"
}
]
}
を次のように次に、上記の応答を解析することができます。 インポートorg.jsonを*;
JSONObject obj = new JSONObject(" .... ");
String pageName = obj.getJSONObject("pageInfo").getString("pageName");
JSONArray arr = obj.getJSONArray("posts");
for (int i = 0; i < arr.length(); i++)
{
String post_id = arr.getJSONObject(i).getString("post_id");
......
}
上記の応答は、GSON libraryまたは他のライブラリを使用して解析することもできます。
Google for android json'、次に 'android run code over time'をGoogleで検索して2つの質問の答えを見つけてください。あなたは1分以上過ごすことはありません。 –