0

I try to parse json response from api server. Json looks like this:

{
    "13.12.2021  Monday": {
        "lessons": [
            {
            "type": "second",
            "lesson":{
                "subject": "ОР и АБД",
                "teacher": "Кузьмина В.М.",
                "room": null
                }
            },
            {
                "type": "common",
                "0": {
                    "subject": "ПМ.2.Р5. РС и ПИР со С и ДК",
                    "teacher": "Голубева Я.С.",
                    "room": "211"
                }
            }
        ],
        "dinner": "11.00 "
        },
    "14.12.2021  Tuesday": {
        "lessons":[
            {
                "type": "common",
                "0":{
                    "subject": "ПМ.2.Р1. ТРОПО",
                    "teacher": "Ахметова Ф.Т.","room":"212"
                }
            },
            {
                "type": "common",
                "0":{
                    "subject": "ПМ.2.Р1. ТРОПО",
                    "teacher": "Ахметова Ф.Т.",
                    "room": "212"
                }
            }
        ],
        "dinner": "11:00 "
    }
}

How should I get access to child json elements? Should I use "for" or "while" loops? Give me an example, please I used this

JSONArray day = json.getJSONObject(key).getJSONArray("lessons");

but idk what to use next

barsikeeee
  • 11
  • 2

0 Answers0