转换
JSONArray为
Arraylist<JSONBbject>并使用集合对您的数组列表进行排序
例如 :
ArrayList<JSONObject> array = new ArrayList<JSONObject>();JSonArray jsonArray = new JSonArray();for (int i = 0; i < jsonArray.length(); i++) { try { array.add(jsonArray.getJSonObject(i)); } catch (JSonException e) { // TODO Auto-generated catch block e.printStackTrace(); }}Collections.sort(array, new Comparator<JSONObject>() { @Override public int compare(JSonObject lhs, JSonObject rhs) { // TODO Auto-generated method stub try { return (lhs.getString("Name").toLowerCase().compareTo(rhs.getString("Name").toLowerCase())); } catch (JSonException e) { // TODO Auto-generated catch block e.printStackTrace(); return 0; } }});


