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 379 views
3 answers 312 views
3 answers 372 views
372 views asked May 24, 2022 by avibootz
3 answers 311 views
1 answer 264 views
264 views asked Feb 16, 2021 by avibootz
1 answer 286 views
286 views asked Feb 16, 2021 by avibootz
3 answers 350 views
350 views asked Feb 15, 2021 by avibootz
...