Is there a way to group object fields in Angular?

I am looking at creating a list with my JSON object and grouping some fields together that have the same title.

[{
    "state": "Illinois",
    "country": "USA"
}, {
    "state": "Florida",
    "country": "USA"
}, {
    "state": "Ontario",
    "country": "Canada"
}]

I’d like to be able to display the list like this:

-USA
--Florida
--Illinois
-Canada
--Ontario

Do I need to create a custom pipe for this or just filter the items a particular way?

Personally, I find pipes a solution in search of a problem. I would simply have a method in whatever service is responsible for retrieving these objects that reorganizes them into the desired format.