标签:android json stringbuffer string
Json解析之JsonArray String str = "{\"phone\" : [\"12345678\", \"87654321\"]}";
try {
//注意List是实现Collection接口的
String str = "{\"phone\" : [\"12345678\", \"87654321\"]}";
JSONObject json = new JSONObject(str);
JSONArray array = json.getJSONArray("phone");
StringBuffer sb = new StringBuffer();
for (int i = 0; i < array.length(); i++) {
String s = (String) array.get(i);
sb.append(s+"\n");
}
textView.setText(sb.toString());
} catch (JSONException e) {
e.printStackTrace();
}
标签:android json stringbuffer string
原文地址:http://blog.csdn.net/menglele1314/article/details/46324069