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 396 views
3 answers 325 views
3 answers 391 views
391 views asked May 24, 2022 by avibootz
3 answers 325 views
1 answer 275 views
275 views asked Feb 16, 2021 by avibootz
1 answer 297 views
297 views asked Feb 16, 2021 by avibootz
3 answers 359 views
359 views asked Feb 15, 2021 by avibootz
...