hey guys, can somebody help me with this algorithm in javascript
I need to make a search in this json, it's dynamic so can have lots folders and I need to look through all of them. The search should work the next way, it should go through all the folders (as I said the number of folders can change) and look for "File2", for example, and indicate its file id. ( for the case of "File2" there is two files with this name and have ids 17 and 15). { "id": 1, "name": "Main", "children": [ { "id": 16, "parentId": 1, "name": "Folder1", "children": [], "files": [ { "id": 14, "name": "File1" }, { "id": 15, "name": "File2" }, { "id": 16, "name": "File3" } ] }, { "id": 2, "parentId": 1, "name": "Folder2", "children": [ { "id": 86, "parentId": 2, "name": "Folder2", "children": [], "files": [ { "id": 17, "name": "File2" }, { "id": 18, "name": "File5" } ] } ], "files": [] } ], "files": [ { "id": 21, "name": "File9" } ] }