I need to group common objects to single with count,how to group the object based on the id in the object and how to add extra key with count in result.
var a =[
{"name":"test","id":101,"price":100},
{"name":"test","id":101,"price":100},
{"name":"test3","id":103,"price":10},
{"name":"test2","id":102,"price":12},
]
output =
[
{"name":"test","id":101,"price":100,"qty":2},
{"name":"test3","id":103,"price":10,"qty":1},
{"name":"test2","id":102,"price":12,"qty":1},
]