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 243 views
3 answers 190 views
3 answers 233 views
233 views asked May 24, 2022 by avibootz
3 answers 181 views
1 answer 172 views
172 views asked Feb 16, 2021 by avibootz
1 answer 208 views
208 views asked Feb 16, 2021 by avibootz
3 answers 243 views
243 views asked Feb 15, 2021 by avibootz
...