I have this array:
[
{"key": 1, "title": "Animalia", "expanded": true, "folder": true, "children": [
{"key": 2, "title": "Chordate", "folder": true, "children": [
{"key": 3, "title": "Mammal", "children": [
{"key": 4, "title": "Primate", "children": [
{"key": 5, "title": "Primate", "children": [
]},
{"key": 6, "title": "Carnivora", "children": [
]}
]},
{"key": 7, "title": "Carnivora", "children": [
{"key": 8, "title": "Felidae"}
]}
]}
]}
]}
]
I want to loop trough the array and when the "key" equals a specified number (let's say 5) I want to insert a "selected": true key=>value
Is there such a possibility?