My json file is filled with various types of beers, such as this example:
{
"type": "Unifiltered",
"name": "Heineken Unfiltered",
"id": "XY",
"brand": "Heineken",
"price": "1250",
"alcohol": "0.04",
"ingredients": [
{
"id": "XY2",
"ratio": "0.15",
"name": "salt"
},
{
"id": "XY3",
"ratio": "0.00",
"name": "sugar"
},
{
"id": "XY4",
"ratio": "0.35",
"name": "barley"
}
],
"isCan": false
},
The challenge at hand involves categorizing these beers by their respective brands:
A friend of mine has a lengthy list of all the beers available in his establishment, a rather chaotic one at that. He wants to organize the beers according to their brand names. Additionally, he mentioned that the function should output an array consisting of Brand > objects containing arrays of Beers for each specific Brand.
For instance:
[{brand: Heineken, beers: [{...}, ...]}]""