Solved
Need to count the items present in same category in json.
Hi,
"Items": [
{
"date": "2022-07-19T08:47:51.456Z",
"bookmark_url": "https://stackoverflow.com/questions/21678430/group-a-list-of-objects-by-an-attribute",
"user_id": "admin",
"category": "Category 4",
"title": "Category 4 bookmark"
},
{
"date": "2022-07-19T08:47:51.456Z",
"user_id": "admin",
"category": "Category 3",
"title": "Category 3 bookmark"
},
{
"date": "2022-07-16T11:01:17.887Z",
"user_id": "admin",
"category": "Category 4",
"title": "Category 4 Title"
},
{
"date": "2022-07-16T11:01:17.887Z",
"user_id": "admin",
"category": "Category 3",
"title": "Category 3 Title"
},
{
"date": "2022-07-16T13:18:24.785Z",
"user_id": "admin",
"category": "Category 1",
"title": "Category 1 Title"
}
],
This is the response I'm getting to the api call I made. I need to List the category from each items and add the count of each category.
I have used jsonobject and json array to iterate through the items and get the category. I'm able get a count of each category. Is there any logic to get the count?
Thank you
