How can I extract and store all grades from the provided JSON data for every year into an array? I am new to JavaScript, so any explanation would be helpful. The expected array based on this example should be [2,4,2,5,4,5,4.5,2,3.5,5,5,5,5,5]
{
"first_name": "Ala",
"last_name": "Kowalski",
"birth_date": "29 AUG 1990",
"indeks_number": "9454530",
"year_of_study": "2",
"courses": {
"2013": {
"AlgorithmsI": {
"grades": {
"exercices": [
2,
4
],
"lecture": [
2,
5
]
}
},
"BasicPhysicsI": {
"grades": {
"exercices": [
4
],
"lecture": [
5
]
}
},
"ProgrammingI": {
"grades": {
"exercices": [
4.5
],
"lecture": [
2,
3.5
]
}
}
},
"2014": {
"ProgrammingII": {
"grades": {
"exercices": [
5
],
"lecture": [
5
]
}
},
"BasicPhysicsII": {
"grades": {
"exercices": [
5
],
"lecture": [
5
]
}
},
"AlgorithmsII": {
"grades": {
"exercices": [
5
],
"lecture": [
5
]
}
}
}
}
}