0
I have this Json that returns from the database, I need to consolidate the data that are equal but I have no idea how to do in jquery or php. If anyone has any suggestions!
{
"data":[
{
"nome_pesquisa":"teste",
"nr_pergunta":"1",
"pergunta":"a",
"qtd":"40"
},
{
"nome_pesquisa":"teste",
"nr_pergunta":"2",
"pergunta":"b",
"qtd":"29"
},
{
"nome_pesquisa":"teste",
"nr_pergunta":"2",
"pergunta":"b",
"qtd":"11"
},
{
"nome_pesquisa":"teste",
"nr_pergunta":"3",
"pergunta":"c",
"qtd":"3"
},
{
"nome_pesquisa":"teste",
"nr_pergunta":"3",
"pergunta":"c",
"qtd":"5"
},
{
"nome_pesquisa":"teste",
"nr_pergunta":"3",
"pergunta":"c",
"qtd":"2"
}
]
}
Consolidate in what way? Add the values and leave only 1 of the equals?
– Sam
that’s right, in case it would appear once each question with the sum total of it.
– Carlos Lopes