I am working with an API named teachers
that has the following structure:
Teachers:
[
{
"id": "01",
"teacherName": "Binky Alderwick",
"studentIds": [
"010",
"024",
"031"
],
"totalStudents":"20"
},
{
"id": "02",
"teacherName": "Basilio Gregg",
"studentIds": [
"041",
"075"
],
"totalStudents":"10"
},
{
"id": "03",
"teacherName": "Binky Alderwick",
"studentIds": [
"075",
"048",
"035"
],
"totalStudents":"40"
}
]
The student data in the JSON file contains multiple strings under the studentIds
property within an array.
I want to count these strings and compare them with the totalStudents
property in order to display the available students as shown here: https://i.sstatic.net/9jTzb.png