I am coding in Html/Javascript, I have a JSON which contains lists : a list of "Intervenant" and in each item of "Intervenant" they have a list of course called "ListCoursa"
Here the JSON :
{
"Intervenant": [
{
"name": "John Doe",
"dateOfBirth": "1980-01-02T00:00:00.000Z",
"registered": true,
"ListeCoursa": [
{
"cours": "Cardio",
"Date": "2016-05-02T00:00:00.000Z",
"Horaire": "9-11",
"Semaine": "1"
},
{
"cours": "Flex",
"Date": "1980-05-02T00:00:00.000Z",
"Horaire": "14-16",
"Semaine": "1"
},
{
"cours": "Basic",
"Date": "2016-05-03T00:00:00.000Z",
"Horaire": "18-20",
"Semaine": "1"
},
{
"cours": "Flex",
"Date": "1980-05-04T00:00:00.000Z",
"Horaire": "14-16",
"Semaine": "1"
},
{
"cours": "Cardio",
"Date": "2016-05-09T00:00:00.000Z",
"Horaire": "9-11",
"Semaine": "2"
},
{
"cours": "Flex",
"Date": "1980-05-09T00:00:00.000Z",
"Horaire": "14-16",
"Semaine": "2"
},
{
"cours": "Basic",
"Date": "2016-05-10T00:00:00.000Z",
"Horaire": "18-20",
"Semaine": "2"
},
{
"cours": "Flex",
"Date": "1980-05-11T00:00:00.000Z",
"Horaire": "14-16",
"Semaine": "2"
}
]
},
{
"name": "John Doe2",
"dateOfBirth": "1980-01-02T00:00:00.000Z",
"registered": true,
"ListeCoursa": [
{
"cours": "Cardio",
"Date": "2016-05-01T00:00:00.000Z",
"Horaire": "10-12",
"Semaine": "10"
},
{
"cours": "Flex",
"Date": "1980-05-02T00:00:00.000Z",
"Horaire": "14-16",
"Semaine": "10"
},
{
"cours": "Basic",
"Date": "2016-05-03T00:00:00.000Z",
"Horaire": "18-20",
"Semaine": "10"
},
{
"cours": "Flex",
"Date": "1980-05-04T00:00:00.000Z",
"Horaire": "14-16",
"Semaine": "10"
},
{
"cours": "Cardio",
"Date": "2016-05-09T00:00:00.000Z",
"Horaire": "9-11",
"Semaine": "10"
},
{
"cours": "Flex",
"Date": "1980-05-09T00:00:00.000Z",
"Horaire": "14-16",
"Semaine": "20"
},
{
"cours": "Basic",
"Date": "2016-05-10T00:00:00.000Z",
"Horaire": "18-20",
"Semaine": "20"
},
{
"cours": "Flex",
"Date": "1980-05-11T00:00:00.000Z",
"Horaire": "14-16",
"Semaine": "20"
}
]
},
{
"name": "John Doe3",
"dateOfBirth": "1980-01-02T00:00:00.000Z",
"registered": true,
"ListeCoursa": [
{
"cours": "Circuit",
"Date": "1980-05-22T00:00:00.000Z",
"Horaire": "8-10",
"Semaine":"210"
},
{
"cours": "Cardio-pump",
"Date": "1980-02-22T00:00:00.000Z",
"Horaire": "16-18",
"Semaine": "210"
}
]
}
]
}
I need to count the number of "cours" in 1 week. For this I've put a variable "Semaine" in the JSON which indicate in what week the course is given ("Semaine": "20" mean the course is given in week 20).
My question is how do I get all the "cours" from "Semaine: number" in javascript ?
I hope I was clear, Thanks.