How to convert JSON to object in JavaScript

1 Answer

0 votes
const json = '{"id":383912,"name":"Albus Dumbledore","academicrank":"Professor"}';

const obj = JSON.parse(json);

console.log(obj);


  
  
/*
run:
  
{
  academicrank: "Professor",
  id: 383912,
  name: "Albus Dumbledore"
}
  
*/

 



answered May 24, 2022 by avibootz

Related questions

1 answer 154 views
1 answer 149 views
1 answer 180 views
1 answer 176 views
1 answer 201 views
2 answers 239 views
1 answer 113 views
...