How to access "type" property in "students" array in API response using Flutter, Laravel and PHP?
P粉744831602
P粉744831602 2024-04-04 19:25:13
0
1
278

"data": {
    "id": 9,
    "name": "tala",
    "role": "Student",
    "email": "tala@gmail.com",
    "students": [
        {
            "id": 1,
            "name": "tala",
            "type": "Master_Degree",
            "year": "third",
            "Semester": null,
            "specializations": "جراحة",
            

        }
    ]
},

I used to receive emails by doing this: Response['data']['email']

How to get "type" from response['data']['student']? ?

P粉744831602
P粉744831602

reply all(1)
P粉311089279

In your data object, students is an array of objects!

So many students can be added!

To access the student attribute, you must loop into the student array.

$students = response["data"]["students"];

foreach($students as $student ) {
  //access to each student in your list
  // do what ever you want
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!