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 384 views
3 answers 316 views
3 answers 379 views
379 views asked May 24, 2022 by avibootz
3 answers 318 views
1 answer 267 views
267 views asked Feb 16, 2021 by avibootz
1 answer 289 views
289 views asked Feb 16, 2021 by avibootz
3 answers 352 views
352 views asked Feb 15, 2021 by avibootz
...