[
{
"subject": "Top exotic beaches in Greece",
"participants": [
"Aristotle", "Socrates"
],
"preview": "Plato,\nThis is what I was talking about for the bachelor party!",
"isRead": false,
"isStarred": true,
"ts": 1471451322,
"id": 5
}
]
如何解析"参与者"从这个json ... thanx提前
答案 0 :(得分:1)
try {
JSONArray participants = jsonObject.getJSONArray("participants")
for (int i = 0; i < participants.length(); i++) {
yourArrayList.add(participants.getString(i))
}
} catch(JSONException e) {
// Handle exception.
}
答案 1 :(得分:1)
JSONArray jsonArray = new JSONArray(mainJSON.getJSONArray("participants"))
然后你就像这样使用你的对象:
jsonArray.getJSONObject(0)