Unable to access json array data

i am trying to access data from a Json file but i can not retrive data from level 2.

let me paste my json here.

    "success": true,
    "data": {
        "bookings": [
                "id": 1,
                "customer_id": 1
    "message": "Current booking list"

i want to access id from within bookings but i only can get data of success and message by doing jsonresponse.success is returns "true" but when i do jsonresponse.data.bookings.id it gives error. please help

>Solution :

jsonresponse.data.bookings is an Array, so if you need to read id of first element you should use jsonresponse.data.bookings[0].id

Leave a Reply