I have a dataset that is an array of objects, and each object is another object with an array inside of it. I am trying to flatten everything to a single array of the innermost objects, without the keys of the middle layer objects. I have tried to use the pluck functionality, but I cannot seem to get to what I am after. Example below.
Input:
[
{
"1234": [
{
"store": "07",
"category": "1234",
"account": "987"
},
{
"store": "07",
"category": "1234",
"account": "555"
},
{
"store": "07",
"category": "1234",
"account": "555"
}
]
},
{
"567": [
{
"store": "07",
"category": "567",
"account": "987"
},
{
"store": "07",
"category": "567",
"account": "555"
},
{
"store": "07",
"category": "567",
"account": "555"
}
]
}
]
Output:
[
{
"store": "07",
"category": "1234",
"account": "987"
},
{
"store": "07",
"category": "1234",
"account": "555"
},
{
"store": "07",
"category": "1234",
"account": "555"
},
{
"store": "07",
"category": "567",
"account": "987"
},
{
"store": "07",
"category": "567",
"account": "555"
},
{
"store": "07",
"category": "567",
"account": "555"
}
]