I have an array like this:
[
{
"name":"Jack"
"category":"football player"
},
{
"name":"Mario"
"category":"football player"
},
{
"name":"Alex"
"category":"football player"
},
{
"name":"John"
"category":"basketball player"
},
{
"name":"Antony"
"category":"basketball player"
},
]
I need to group the array by the category, and then loop all this and show the 2 categories with all the football players and all the basketball players.
Like this:
Football player:
Jack Mario Alex
Basketball player:
John Antony