-5
得到一個特定的項目我有這些JSONArray如何從JSONArray
[
{
"cid": "6",
"pid": "0",
"nid": "28",
"uid": "1",
"subject": "ciaooo",
"hostname": "62.98.160.246",
"created": "1441816543",
"changed": "1441816543",
"status": "1",
"thread": "04/",
"name": "uniwalltest",
"mail": "",
"homepage": "",
"language": "und",
"uri": "http://uniwalltest.altervista.org/portale/?q=app/comment/6"
},
{
"cid": "5",
"pid": "0",
"nid": "28",
"uid": "1",
"subject": "rhdhdhdjj cisioos",
"hostname": "62.98.160.246",
"created": "1441816301",
"changed": "1441816301",
"status": "1",
"thread": "03/",
"name": "uniwalltest",
"mail": "",
"homepage": "",
"language": "und",
"uri": "http://uniwalltest.altervista.org/portale/?q=app/comment/5"
}
]
我不會顯示僅須與NID 28項,這是我的代碼:
for(int j=0;j<result.length();j++) {
try {
title.add(result.getJSONObject(j).getString("subject").toString());
} catch (Exception e) {
Log.v("Error", e.getMessage());
}
}
謝謝,
檢查http://github.com/mohit008/Android-Json-例子 – Mohit
JSONArray的關鍵是什麼? – Rajesh