View difference between Paste ID: v843WFtD and AtJKSx6R
SHOW: | | - or go back to the newest paste.
1
public class MenuObj {
2
    String id = "";
3
    String name = "";
4
    String description = "";
5
    String fixedPrice = "0.00";
6
    ArrayList<IngredientObj> children = new ArrayList<IngredientObj>();
7
}
8
9
10
public class IngredientObj {
11
    String id = "";
12
    String name = "";
13
    String description = "";
14
}
15
16
17
// in RestClass
18
    private void getMenuData(String result) {
19
        Log.e(TAG, "getMenuData NEW");
20
        System.out.println(result);
21
        ObjectMapper mapper = new ObjectMapper();
22
        try {
23
            MenuObj[] menuList = mapper.readValue(result, MenuObj[].class);
24
            for(MenuObj menu : menuList){
25
                System.out.println("menu.id: "+menu.id);
26-
                for(Object ingr : menu.children){
26+
                for(IngredientObj ingr : menu.children){
27
                    System.out.println("Ingredient: "+ingr.toString());
28
                }
29
            }
30
        } catch (IOException e) {
31
            e.printStackTrace();
32
        }
33
34
    }