我有類似下面的J-兒子響應,如何用android中的兩個值解析json對象?
{
"client_id": "1",
"template_id": "4",
"scrolling_text": "scrolling Text for android",
"bottom": "scrolling Text for android",
"Left": [
"http://www.qwerty.com/iDigitalSign/img/files/20130925043454Chrysanthemum.jpg",
"http://www.qwerty.com/iDigitalSign/img/files/RightTulips.jpg"
],
"Right": [
"http://www.qwerty.com/iDigitalSign/img/files/BottomKit_Kat_Dancing_Kids_TV_Commercial_-_YouTube.3gp"
]
}
我解析
InputStream in = response.getEntity().getContent();
Json_response json_res_class = new Json_response();
String a = json_res_class.convertStreamToString(in);
try {
jsonarray = new JSONArray("[" + a + "]");
json = jsonarray.getJSONObject(0);
String client_id = json.getString("client_id");
String template_id = json.getString("template_id");
scrolling_text = json.getString("scrolling_text");
String bottom = json.getString("bottom");
Left = json.getString("Left");
videoPath = json.getString("Right");
} catch (Exception e) {
e.printStackTrace();
}
我解析所有的事情,但我想在數組列表把左對象值一個接一個。我不知道該怎麼做,能否有人知道幫我解決這個問題
如何我讀留下了找到正確的對象。 – Yugesh
k k現在只讀了你的完整答案我得到它,我試了一下。 – Yugesh