1 point

JSON.parse() - convert string into a JavaScript object


dashboard

Sun Jan 19 2020 18:48:17 GMT+0000 (UTC)

Posted by @storiesreptile #javascript #json #jsfunctions

var contacts = '{ "people" : [' +
'{ "firstName":"Joe" , "lastName":"Smith" },' +
'{ "firstName":"Tom" , "lastName":"Hardy" },' +
'{ "firstName":"Ben" , "lastName":"Stiller" } ]}';

var newObject = JSON.parse(contacts);

content_copy Copy