0

enter image description here

As you see, I have a json. And I retrieved it . But i can retrieve the category's ID,name. But I have to change my Project to Object. So, How can i iterate my project. Or there is any another way to do it ?

user2988394
  • 69
  • 2
  • 6

1 Answers1

0

Here I just get the ID from Jsonarray,use this way to get the other jsonobject element inside the jsonarray do like that for rest of the elements.

 try{

        ArrayList<String>ID=new ArrayList<String>();

        JSONObject jObject= new JSONObject(JsonString);
        JSONArray menuObject = new JSONArray(jObject.getString("category"));    
        JSONArray menuObject1;
        for(int i=0;i<menuObject.length;i++){

        menuObject1 = new JSONArray(jObject.getString("project"));

        }
        for(int i=0;i<menuObject1.length;i++){
        String ID= menuObject.getJSONObject(i).getString("ID");
        ID.add(ID);

        }
        }catch(Exception e){
        }   
Nambi
  • 11,944
  • 3
  • 37
  • 49