Reputation: 23
http://app.webcraft.co.in/eschool/parent/parentsjson/getexams?parent_id=2&student_id=1 my API URL
my response:
[{
"exam_name": "Test - April",
"exam_result": [{
"exam_schedule_id": "4",
"exam_id": "2",
"full_marks": "100",
"passing_marks": "35",
"exam_name": "Brandon",
"exam_type": "Theory",
"attendence": "pre",
"get_marks": "45.00",
"status": "pass"
}, {
"exam_schedule_id": "5",
"exam_id": "2",
"full_marks": "100",
"passing_marks": "35",
"exam_name": "English",
"exam_type": "Theory",
"attendence": "pre",
"get_marks": "50.00",
"status": "pass"
}, {
"exam_schedule_id": "6",
"exam_id": "2",
"full_marks": "100",
"passing_marks": "35",
"exam_name": "Hindi",
"exam_type": "Theory",
"attendence": "pre",
"get_marks": "42.00",
"status": "pass"
}],
"full_mrk": 300,
"pass_mrk": 105,
"get_mrk": 137,
"percentage": "45.67",
"grade": "C"
}, {
"exam_name": "Test - May",
"exam_result": [{
"exam_schedule_id": "7",
"exam_id": "3",
"full_marks": "100",
"passing_marks": "35",
"exam_name": "Brandon",
"exam_type": "Theory",
"attendence": "pre",
"get_marks": "45.00",
"status": "pass"
}, {
"exam_schedule_id": "8",
"exam_id": "3",
"full_marks": "100",
"passing_marks": "35",
"exam_name": "English",
"exam_type": "Theory",
"attendence": "pre",
"get_marks": "60.00",
"status": "pass"
}, {
"exam_schedule_id": "9",
"exam_id": "3",
"full_marks": "100",
"passing_marks": "35",
"exam_name": "Hindi",
"exam_type": "Theory",
"attendence": "ABS",
"get_marks": "0.00",
"status": "fail"
}],
"full_mrk": 300,
"pass_mrk": 105,
"get_mrk": 105,
"percentage": "35.00",
"grade": "D"
}, {
"exam_name": "Test - August",
"exam_result": []
}, {
"exam_name": "Final Exam",
"exam_result": [{
"exam_schedule_id": "25",
"exam_id": "5",
"full_marks": "100",
"passing_marks": "35",
"exam_name": "Brandon",
"exam_type": "Theory",
"attendence": "pre",
"get_marks": "20.00",
"status": "fail"
}, {
"exam_schedule_id": "27",
"exam_id": "5",
"full_marks": "100",
"passing_marks": "35",
"exam_name": "English",
"exam_type": "Theory",
"attendence": "pre",
"get_marks": "40.00",
"status": "pass"
}, {
"exam_schedule_id": "28",
"exam_id": "5",
"full_marks": "100",
"passing_marks": "35",
"exam_name": "Hindi",
"exam_type": "Theory",
"attendence": "pre",
"get_marks": "40.00",
"status": "pass"
}],
"full_mrk": 300,
"pass_mrk": 105,
"get_mrk": 100,
"percentage": "33.33",
"grade": "D"
}]
Upvotes: 0
Views: 359
Reputation: 7498
If you are getting response in string format, you would first need to convert it to object format using "dart:convert", eg
dynamic responseObject = new JsonEncoder().convert(responseString);
This should give you List or Map based on your response structure. Which you can traverse using keys like map["exam_name"] or using forEach statements.
Upvotes: 1