I have an array of objects as below. I want to sort the array with categories and also find the number of total item in each category. As in below example all category with "toys" should come one after other and it should also be easy to get the count like in below example it is 2(for toys category).
[
{ "category": "toys", "name": "cycle", "itemID": 1594, "price": 1594},
{ "category": "furniture", "name": "chair", "itemID": 15954, "price": 1594},},
{ "category": "furniture", "name": "table", "itemID": 15344, "price": 1594},},
{ "category": "books", "name": "twoLittle", "itemID": 153594, "price": 1594},},
{ "category": "electronic", "name": "Tape", "itemID": 134594, "price": 1594},},
{ "category": "books", "name": "oneLittle", "itemID": 1594436, "price": 1594},},
{ "category": "electronic", "name": "TV", "itemID": 159446, "price": 1594},
{ "category": "toys", "name": "car", "itemID": 1534694, "price": 1594},
]
Any help in right direction would be highly appreciated.
Thanks in advance.