I need to search the elements containing the searched text in a parent and child structure, similar to this:
[
{
"id": "1",
"name": "Apple",
"value": "1",
"children": [
{
"id": "4",
"name": "iPhone",
"value": "4",
}
]
},
{
"id": "2",
"name": "Samsung",
"value": "2",
"children": [
{
"id": "5",
"name": "Android",
"value": "5",
}
]
},
{
"id": "3",
"name": "AppleX",
"value": "3",
}
]
An example: the user searched for the string "Apple", he would need to filter all the elements of this structure that contain this string "Apple".
The search is always based on the object name.