0

I am a newbie to android. I am stuck at JSON parsing. Following is my JSON, in this, the type of menu categories will be dynamic, and I want to arrange this JSON in sectioned recycler view. Please help me out. This is my JSON

{
    "menu_items": {
        "Plat": [{
                "menu_name": "jambon à l'os",
                "menu_cost": "18.00",
                "menu_count": "1",
                "category": "Plat",
                "menu_tax": "5.50",
                "code": "€"
            },
            {
                "menu_name": "tacos",
                "menu_cost": "6.00",
                "menu_count": "1",
                "category": "Plat",
                "menu_tax": "5.50",
                "code": "€"
            }
        ],
        "Entrée": [{
            "menu_name": "avocat",
            "menu_cost": "7.50",
            "menu_count": "1",
            "category": "Entrée",
            "menu_tax": "5.50",
            "code": "€"
        }]
    },
    "order_data": {
        "order_id": "278",
        "order_number": "REF-5d5e6b86",
        "created_at": "1566468998",
        "instructions": "",
        "fullname": "Rohan Chitnis",
        "phonenumber": "7610771871",
        "useraddress": "Brest, France",
        "image_path": "https://restau-at-home.bzh/uploads/attachments/Jellyfish_2019_08_21_10_49_21.jpg",
        "wp": "pune",
        "code": "€",
        "promocode": null,
        "promo_value": null,
        "promo_type": null
    },
    "order_details": {
        "total_items": "3",
        "order_total": "31.50"
    },
    "promo_applied": "0",
    "error": {
        "code": "13",
        "status": "200",
        "message": "Ok"
    }
}
NewBie
  • 11
  • 1
  • 4
    Welcome to stackoverflow. This isn't a free coding service. Please take the [tour], and especially read [ask]. Then [edit] your question and add the code you've tried so far. What happens when you run it? What did you expect to happen instead? Any errors? If you don't know where to start coding, do a web search and read some tutorials first. Good luck! – Robert Aug 22 '19 at 13:18

1 Answers1

0

Check this out. Create a generic response class. Extend your classes from that class. To do this properly you can look at Java Generics and Inheritance topics if you are using Java. And then search about Sectioned RecyclerView in Android. Here is a library for this.

faranjit
  • 1,567
  • 1
  • 15
  • 22