I have a JSON that looks like this
[{
"teacher": "teacher1",
"student": "student1",
"segment": "product"
},
{
"teacher": "teacher1",
"student": "student1",
"segment": "UNR"
},
{
"teacher": "teacher1",
"student": "student1",
"segment": "product"
},
{
"teacher": "teacher2",
"student": "student1",
"segment": "UNR"
},
{
"teacher": "teacher2",
"student": "student2",
"segment": "product"
}
]
With the help of create complex table from the Json data i can create an array counting each teacher and its count by I want to add another detail in it now. I want to calculate the instance of the segment for each teacher as well like below
[
{
"teacherName": "teacher1",
"teacherCount": "3",
"productCount":"2",
"unrCount":"1"
},
{
"teacherName": "teacher2",
"teacherCount": "2",
"productCount":"1",
"unrCount":"1"
}
]