I have a list of maps as shown
pet_store = [
{
animal_type = "cat"
animal_name = "fluffy"
},
{
animal_type = "cat"
animal_name = "blah"
},
{
animal_type = "dog"
animal_name = "bingo"
}
]
I want to convert that list of maps into this:
pet_store2 = [
{
animal_type = "cat"
animal_name = ["fluffy", "blah"]
},
{
animal_type = "dog"
animal_name = ["bingo"]
}
]
I’ve tried various for expressions and merge, but I can’t get the correct combination to combine the values as shown. Any guidance would be greatly appreciated.