After receiving GraphQL results, I am faced with a challenge to process them using JavaScript
{
"data": {
"shoeStyleColor": [
{
"id": 1,
"shoeInventories": [
{
"id": 1,
"qty": 2,
"size": 6.5
},
{
"id": 2,
"qty": 2,
"size": 9
}
]
},
{
"id": 2,
"shoeInventories": [
{
"id": 5,
"qty": 3,
"size": 8
},
{
"id": 6,
"qty": 1,
"size": 9
}
],
}
]
}
}
I aim to extract a unique list of sizes like this... [6.5,8,9]
[...new Set(products.data.shoeStyleColor.map(x => x.shoeInventories.map(y => y.size)))]
However, the output is not as expected: [6.5,9],[8,9]
What steps should be taken to filter the entire array based on a selected size, for example, 9? Any suggestions?