I have the following reactjs code -
const [interviewerDetails,setinterviewerDetails] =useState([]);
useEffect(()=>{
const getinterviewerDetails= async ()=>{
const data1 = await axios.get("http://localhost:8083/api/GetProduct")
.then(response => {
console.log("role is "+response.data[0].role)
setinterviewerDetails(response.data)
console.log(interviewerDetails)
})
.catch(error => { console.log(error) })
setinterviewerDetails(data1);
};
getinterviewerDetails();
},[])
console.log("interviewerDetails : ", interviewerDetails)
Which is giving the following response in console -

Now, I want to have that json response as following -
var InterviewerObject = {
"HR": {
"Communication": ["Akshay ", "Images", "Tables", "Lists"],
},
"Technical": {
"PHP": ["Arvind Gupta", "Sri sharma", "Vidyut Tope"],
"SQL": ["Akash Jha", "Mohit Mane", "Suresh Tupe"]
}
}
I want to have select technical skill dynamically as PHP,SQL etc. And the firstname and lastname dynamically as Arvind Gupta , Sri sharma etc.
Can you please help me out ?