I have array
"permissions": [
{
"module": "transactions",
"sub_module": [
{
"name": "health",
"headers": [
{
"header_id": "651526995487452392fba692",
"status": true,
"_id": "65153030866481f26ac30f13"
},
{
"header_id": "651526a75487452392fba695",
"status": true,
"_id": "65153030866481f26ac30f14"
},
{
"header_id": "651526ac5487452392fba698",
"status": true,
"_id": "65153030866481f26ac30f15"
},
{
"header_id": "651526b25487452392fba69b",
"status": true,
"_id": "65153030866481f26ac30f16"
},
{
"header_id": "651526c85487452392fba69e",
"status": false,
"_id": "65153030866481f26ac30f17"
}
]
}
]
},
{
"module": "dashbord",
"sub_module": [
{
"name": "health",
"headers": [
{
"header_id": "651526995487452392fba692",
"status": true,
"_id": "65153030866481f26ac30f0d"
},
{
"header_id": "651526a75487452392fba695",
"status": true,
"_id": "65153030866481f26ac30f0e"
},
{
"header_id": "651526ac5487452392fba698",
"status": true,
"_id": "65153030866481f26ac30f0f"
},
{
"header_id": "651526b25487452392fba69b",
"status": true,
"_id": "65153030866481f26ac30f10"
},
{
"header_id": "651526c85487452392fba69e",
"status": false,
"_id": "65153030866481f26ac30f11"
}
]
},
{
"name": "car",
"headers": [
{
"header_id": "651526995487452392fba692",
"status": true,
"_id": "65153030866481f26ac30f0d"
},
{
"header_id": "651526a75487452392fba695",
"status": true,
"_id": "65153030866481f26ac30f0e"
},
{
"header_id": "651526ac5487452392fba698",
"status": true,
"_id": "65153030866481f26ac30f0f"
},
{
"header_id": "651526b25487452392fba69b",
"status": true,
"_id": "65153030866481f26ac30f10"
},
{
"header_id": "651526c85487452392fba69e",
"status": false,
"_id": "65153030866481f26ac30f11"
}
]
}
]
}
]
````Preformatted text`
i want like this
"permissions": [
{
"module": "transactions",
"sub_module": [
{
"name": "health",
"headers": [
{
"name": "view",
"status": true,
"_id": "65153030866481f26ac30f13"
},
{
"name": "add",
"status": true,
"_id": "65153030866481f26ac30f14"
},
{
"name": "edit",
"status": true,
"_id": "65153030866481f26ac30f15"
},
{
"header_id": "remove",
"status": true,
"_id": "65153030866481f26ac30f16"
},
{
"name": "download",
"status": false,
"_id": "65153030866481f26ac30f17"
}
]
}
]
},
{
"module": "dashbord",
"sub_module": [
{
"name": "health",
"headers": [
{
"name": "view",
"status": true,
"_id": "65153030866481f26ac30f0d"
},
{
"name": "add",
"status": true,
"_id": "65153030866481f26ac30f0e"
},
{
"name": "edit",
"status": true,
"_id": "65153030866481f26ac30f0f"
},
{
"name": "remove",
"status": true,
"_id": "65153030866481f26ac30f10"
},
{
"header_id": "download",
"status": false,
"_id": "65153030866481f26ac30f11"
}
]
},
{
"name": "car",
"headers": [
{
"name": "view",
"status": true,
"_id": "65153030866481f26ac30f0d"
},
{
"name": "add",
"status": true,
"_id": "65153030866481f26ac30f0e"
},
{
"name": "edit",
"status": true,
"_id": "65153030866481f26ac30f0f"
},
{
"name": "remove",
"status": true,
"_id": "65153030866481f26ac30f10"
},
{
"name": "download",
"status": false,
"_id": "65153030866481f26ac30f11"
}
]
}
]
}
]
````Preformatted text`
to fetch name of header use header_id from header table