为什么这个JSON值未定义?

Red*_*ama -2 javascript json

我有一个变量json,当我称之为console.log(json)输出时{"buildingName":"", "addressLine1":"", "postcode":""}

为什么,当我打电话时console.log(json.postcode),我会得到undefined什么?

编辑

console.log(typeof json)确实输出'string'.感谢大家的帮助!

dec*_*eze 5

json仍然是一个字符串,你需要JSON.parse它将它变成一个对象.现在你试图访问未定义的属性postcodeString.