i have following data which iam getting from an API call
{
"articles": {
"articles": [
{
"active": true,
"scanCodes": [
"356448",
"875736475896"
],
"stock": {
"1": {
"stockCurrent": 6.0,
"stockCustomValue": 0.0,
"stockMinimum": 4.0,
"stockTarget": 14.0
}
},
"taxRate": 7.0
},
{
"active": true,
"scanCodes": [
"682360596",
"2355235",
"235235235"
],
"stock": {
"1": {
"stockCurrent": 1.0,
"stockCustomValue": 1.0,
"stockMinimum": 2.0,
"stockTarget": 6.0
},
"3": {
"stockCurrent": 4.0,
"stockCustomValue": 0.0,
"stockMinimum": 2.0,
"stockTarget": 7.0
}
},
"taxRate": 7.0
},
{
"active": true,
"scanCodes": [
"50001112547160"
],
"stock": {
"1": {
"stockCurrent": 1.0,
"stockCustomValue": 1.0,
"stockMinimum": 2.0,
"stockTarget": 7.0
},
"2": {
"stockCurrent": 2.0,
"stockCustomValue": 0.0,
"stockMinimum": 0.0,
"stockTarget": 1.0
}
},
"taxRate": 7.0
},
]
}
}
I only need stock unique object keys of each article something like this ["1","2","3","5"....etc]
I have tried this code and so many others but still have not gotten the correct result please help me out I will be really thankful to you
resp.data.articles.articles.
reduce((p, c) => {
let { stock } = c
return { ...p.stock + Object.keys(stock) };
}, {})