The JSON parse() static method takes a string in JSON format and converts it to an object.
const city = '{"city":"Detroit","state":"Michigan","founded":1701}';
const cityObj = JSON.parse(city);
// typeof doesn't work to show type object
console.log(cityObj);
{
city: "Detroit",
founded: 1701,
state: "Michigan"
}
console.log(cityObj.founded);
// 1701