I have a JSON that looks like this
[
{
"teacher": "teacher1",
"student": "student1"
},
{
"teacher": "teacher1",
"student": "student1"
},
{
"teacher": "teacher1",
"student": "student1"
},
{
"teacher": "teacher2",
"student": "student1"
},
{
"teacher": "teacher2",
"student": "student2"
}
]
I want to convert it in a way that it shows me the count for each teacher like this
[
{
"teacherName": "teacher1",
"teacherCount": "3"
},
{
"teacherName": "teacher2",
"teacherCount": "2"
},
]
I am working on a node project where I need to print this data in a table.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…