Is there a way to extract the data value
from the list
without relying on index positions, considering that the order of arrays can change? I need to specifically target data where code === "size"
. Unfortunately, the existing structure cannot be modified. The only solution that comes to mind is using filter
, but it requires indexing which is not feasible.
The desired result should be 100 150
[
[
"color",
{
"name": "Цвет",
"code": "color",
"list": [
{
"value": "Зеленый"
},
{
"value": "Красный"
}
]
}
],
[
"size",
{
"name": "Размер",
"code": "size",
"list": [
{
"value": "100"
},
{
"value": "150"
}
]
}
]
]