Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

228
Views
How to have json data dynamically in javascript variable?

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 - enter image description here

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 ?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!