How to get the values from Nested Json

Hi everyone
I am using Arduino_JSON lib to get the data from an API.
I need to print the data in display so i need to extract it.
when the data is coming in simple form like below
{"status":"SUCCESS","msg":"","deviceID":"ABC","deviceTitle":"Test","deviceStatus":"active","name":"Venom","date_of_birth":"2015-01-22"}

the I am able to extract it using this way

JSONVar deviceID = myObject[keys[2]];
JSONVar deviceTitle = myObject[keys[3]];
JSONVar deviceStatus = myObject[keys[4]];
JSONVar Name = myObject[keys[5]];
JSONVar date_of_birth = myObject[keys[6]];

But now data is coming in Nested Json Array and I am confused how to get it out

 [
        {
            "medicine_name": "Paracetamol",
            "instruction": "In case of fever",
            "medicine_start_date": "2022-08-09",
            "medicine_end_date": "2022-08-15",
            "t1": "08:00:00",
            "t2": "",
            "t3": "16:00:00",
            "t4": ""
        },
        {
            "medicine_name": "Crocin",
            "instruction": "Body Pain",
            "medicine_start_date": "2022-08-09",
            "medicine_end_date": "2022-08-10",
            "t1": "08:00:00",
            "t2": "",
            "t3": "",
            "t4": ""
        }
    ]

Please help me solve this problem.

Regards
Rajbir

You may want to have a look at the ArduinoJson library instead.

I am not saying it is better, but at least the documentation is readily available.

Thank you but half of my code is built using the Arduino_JSON lib and because of less time available I can't edit that.

So I am planning to go with Arduino_JSON only.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.