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

PHOTO EMBED

Sun Jan 19 2020 18:48:17 GMT+0000 (Coordinated Universal Time)

Saved 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_copyCOPY