Android Json parsing Jsonobject Jsonarray
I only resolved one, no matter how many of them by this method analogy, plus http://blog.csdn.net/menglele1314/article/details/46324069 in the Jsonarray analysis, can cope with the general so the development of
try {
String value = "{\" result\ ": \" s\ ", \" Address\ ": [{\" shengfen\ ": \" shanghai \ "},{\" shengfen\ ": \" beijing \ "},{\" shengfen\ ": \" shenzhen \ "}] }";
jsonobject jsonobject = new Jsonobject (value);
String result = jsonobject.getstring ("result");
StringBuffer sb = new StringBuffer ();
Sb.append (result+ "\ n");
Jsonarray array = jsonobject.getjsonarray ("address");
if (array! = NULL && array.length ()! = 0) {
for (int i = 0; i < array.length (); i++) {
Jsonobject JsonObject1 = Array.getjsonobject (i);
String Shengfen = jsonobject1.getstring ("Shengfen");
Sb.append (shengfen+ "\ n");
}
}
Textview.settext (Sb.tostring ());
} catch (Jsonexception e) {
E.printstacktrace ();
}
Android Json parsing Jsonobject Jsonarray