json 里面获取key值
2016-06-03 本文已影响356人
_夏兮
public static ArrayListgetKeyValue(String JsonString){
ArrayListkeyList = new ArrayList();
String key="";
try {
JSONObject obj= new JSONObject(JsonString);
Iterator it = obj.keys();
while (it.hasNext()) {
key= (String)it.next().toString();
keyList.add(key);
}
} catch (JSONException e) {
e.printStackTrace();
}
return keyList;
}