I have a JSON object that looks like the following
{
"venue": {
"time1": [
{
"Status": "Available"
},
{
"Status": "Unavailable"
},
{
"Status": "Unavailable"
}
],
"time2": [
{
"Status": "Available"
},
{
"Status": "Available"
},
{
"Status": "Unavailable"
}
]
}
}
I want to loop over this object and create a new object that has the times as the key and an array of status' as it's values. So the new object would look like the following...
{
"time1": ["Available", "Unavailable", "Unavailable"],
"time2": ["Available", "Available", "Unavailable"]
}
NB: I'm struggling with this, because i can't manage to reach the array. I have tried various maps, reduce etc. but with no joy, and I can't seem to find the right answer on SO because, I'm not sure what to search for.