How to convert JSON to an object in JavaScript

1 Answer

0 votes
const json = '{"name":"Tom","age":56,"profession":"Developer"}';

const obj = JSON.parse(json);

console.log(obj);
 
 
 
   
/*
run:
 
{ name: 'Tom', age: 56, profession: 'Developer' }
 
*/

 



answered Mar 21, 2020 by avibootz

Related questions

1 answer 285 views
1 answer 235 views
1 answer 242 views
1 answer 254 views
1 answer 299 views
2 answers 377 views
...