I want to change the checked value base on the id kindly help me to solve this.I’ll pass an id which have to match in each object in sub_cat and if any result found then change the check value
"data": [
{
"id": "1",
"name": "Electrical Repair & installation",
"parent_id": "0",
"image": "assets/images/Group66.png",
"checked": "false",
"sub_cat": [
{
"id": "7",
"name": "Sockets",
"parent_id": "1",
"image": "assets/images/Group66.png",
"checked": "false"
},
{
"id": "8",
"name": "Fans",
"parent_id": "1",
"image": "assets/images/Group67.png",
"checked": "true"
}
]
},
]
Ofc, you can wrap it in function and add a check if item is found, but i’m leaving it up to you 🙂