Iam working on Json and successfully parsed jsonarray.My Jsonarray looks like [1,2,3,5,23,534,23] and i added this Jsonarray in int array.i wrote this code and everything is ok this is a my code
public List<Integer> ParseJson(String json, List<Integer> myList) {
JSONArray jsonArray = null;
try {
JSONObject mainJson = new JSONObject(json);
jsonArray = mainJson.getJSONArray("result");
myList = new ArrayList<Integer>();
for (int i = 0; i < jsonArray.length(); i++) {
myList.add(Integer.parseInt(jsonArray.get(i).toString()));
}
// System.out.println(myList);
} catch (JSONException e) {
e.printStackTrace();
}
Collections.reverse(myList);
return myList;
}
as i said at the moment everything is ok but i want to reverse this Jsonarray and then add it to my int array. how i can solve my problem? if anyone knows solution please help me
0 comments:
Post a Comment