I have some json like this
const help = [
{
"en": [
{
"test2": [
{
"title": "Naslov1",
"subtitle": "Podnaslov1",
"answers": [
{
"answer": "Odgovor 11"
},
{
"answer": "Odgovor 12"
}
]
}
],
"test1": [
{
"title": "Naslov2",
"subtitle": "Podnaslov2",
"answers": [
{
"answer": "Odgovor 21"
},
{
"answer": "Odgovor 22"
}
]
}
]
}
]
}
]
I need to filter this json to some property, i have properties en and test2 my new object should look like
const newArray = [ {
"title": "Naslov1",
"subtitle": "Podnaslov1",
"answers": [
{
"answer": "Odgovor 11"
},
{
"answer": "Odgovor 12"
}
]
}]
I have tried help.en.test2 but i got error TypeError: Cannot read property 'test2' of undefined
Anyone can help me how to remap this, thanks