I'm trying to loop through some JSON that has some nested data. The JSON structure is such:
var data =[
{"otherdata":"tons of other data",
"studentlist":{
"user":{
"first":"john",
"last":"doe",
"status":"good",
"id":"100404"
},
"user":{
"first":"jane",
"last":"doe",
"status":"bad",
"id":"100405"
}
}];
I'm trying to loop through "data", but more importantly, I need to loop through each user. However using jquery's .each(), but it either fails or shows an error for .length. When I'm tracing out in my console.
var student = data.studentlist;
$.each(student, function(i, item){
console.log('student: ' + student.user[i].id);
});