I'm working on a Vue project and I'm just new to Vue JS, my question is how can I return all data that has an id of 1 when I input a value. below is a sample structure of my data.
{
'A': [{
1: [{
id: 1,
name: 'John'
}],
2: [{
id: 5,
name: 'Ken'
}]
}],
'B': [{
1: {
id: 1,
name: 'Leena'
}
}],
'C': [{
1: [{
id: 1,
name: 'Jesica'
}],
2: [{
id: 18,
name: 'Mike'
}]
}]
}
Expected result should be (below), since they all have same id value
{
'A': [{
1: [{
id: 1,
name: 'John'
}]
}],
'B': [{
1: {
id: 1,
name: 'Leena'
}
}],
'C': [{
1: [{
id: 1,
name: 'Jesica'
}]
}]
}
foo['A'][0][1]could be an array of many objects, and you want any of those objects withid==1returned in the filtered array?