Home  »  CodeLibrariesProgrammingSnippetsTechnologyTools   »   JavaScript Parse JSON Code

JavaScript Parse JSON Code

Posted: March 15, 2022 | by Michael Bright

JavaScript parse JSON code example.

var json = '{ "first_name":"Tommy", "age":46 }';

var personObject = JSON.parse( json ); // parse JSON string into JavaScript object

console.log( personObject.first_name ); // Tommy

console.log( personObject.age ); // 46

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.