How to use JSON.parse in JavaScript

1 Answer

0 votes
const json = '{"name": "Tom", "age": 45, "active": true}';

const parsedJson = JSON.parse(json)


console.log(parsedJson.name);
console.log(parsedJson.age);
console.log(parsedJson.active);



  
/*
run:

Tom
45
true

*/

 



answered Mar 20, 2020 by avibootz

Related questions

3 answers 388 views
3 answers 318 views
3 answers 383 views
383 views asked May 24, 2022 by avibootz
3 answers 318 views
1 answer 269 views
269 views asked Feb 16, 2021 by avibootz
1 answer 290 views
290 views asked Feb 16, 2021 by avibootz
3 answers 353 views
353 views asked Feb 15, 2021 by avibootz
...