I would like to group json object by "topic_id" and sum "score" of each "topic_id".
I have json object like this
{
"topic_id": {
"0": 1,
"1": 1,
"6": 2,
"8": 2,
"12": 3,
"13": 3,
"18": 4,
"20": 4,
},
"score": {
"0": 1,
"1": 3,
"6": 2,
"8": 3,
"12": 3,
"13": 1,
"18": 3,
"20": 3,
}
}
My result should be
{
"topic_id" : {
"0" : 1,
"1" : 2,
"2" : 3,
"3" : 4,
},
"score" : {
"0" : 4,
"1" : 5,
"2" : 4,
"3" : 6,
}
}
Hope anyone can help me.
Thank so much.