我正在尝试以"attributes"
这些 json 格式获取数据,但我总是得到undefined
{ "data": [
{ "attributes":
{
"id":"4977",
"book_id":"651284829",
"provider_id":"1",
"title":"\u96e8\u8272\u30b3\u30b3\u30a2",
"author":"IAM, K.K.",
"price":"170.00",
"rating":"4"
},
...
}
}
这是我的代码,它总是返回undefined
:
for ( var obj in json.data) {
var att = obj.attributes;
html += "<p>" + att.author + "</p>";
}