I have data in the below format

```
{
    games: [{id: "1", category_name: "Men Age above 18", game: "Running 100 Mtrs", isActive: "1"}, {
        id: "2",
        category_name: "Men Age above 18",
        game: "Running 200 Mtrs",
        isActive: "1"
    }, {id: "3", category_name: "Men Age above 18", game: "Running 400 Mtrs", isActive: "1"}, {
        id: "4",
        category_name: "Men Age above 18",
        game: "Long Jump",
        isActive: "1"
    }, {id: "5", category_name: "Men Age above 18", game: "Tug of War (Team)", isActive: "1"}, {
        id: "6",
        category_name: "Women Age above 18",
        game: "Rangoli",
        isActive: "1"
    }, {id: "7", category_name: "Women Age above 18", game: "Kho Kho (Team)", isActive: "1"}]
}

```

I want the data to be organized the way below:

```
gameGroups = {
    'Men Age above 18': ['Running 100 Mtrs', 'Running 200 Mtrs', 'Running 400 Mtrs', 'Long Jump', 'Tug of War (Team)'],
    'Women Age above 18': ['Rangoli', 'Kho Kho (Team)']
}

```

I got the result with the below code:

```
gameGroups = {};
cat_array = [];

for (i = 0; i < data['games'].length; i++) {
        gameGroups[data['games'][i]['category_name']] = [];
      }

      for (var key in gameGroups) {
        cat_array = [];
        for (i = 0; i < data['games'].length; i++) {
          if (data['games'][i]['category_name'] === key)
            cat_array.push(data['games'][i]['game'])
        }

        if (gameGroups.hasOwnProperty(key)) {
          gameGroups[key] = cat_array;
        }
      }

```

The above code is valid but lengthy.

Can there be some other method to do this in an easier way?