0

我正在使用 jQuery 模板插件来显示来自 Google Books API 的 JSON 信息,以在此处生成书单:http: //jsfiddle.net/yuW6L

我可以使用模板标签从 JSON 中获取并显示基本信息,例如标题

{{each items}}

${volumeInfo.title}

但是 ISBN 嵌套在 JSON 的一部分中,如下所示:

...
"industryIdentifiers":[
                     {
                        "type":"ISBN_10",
                        "identifier":"1593374313"
                     },
                     {
                        "type":"ISBN_13",
                        "identifier":"9781593374310"
                     }

我无法以这种方式显示 ISBN-10:

volumeInfo.industryIdentifiers.identifier[1]

我不认为我可以这样做:

{{each items.volumeInfo.industryIdentifiers}}
...
${identifier}

解析和显示 ISBN-10 的方法是什么?

4

1 回答 1

1

您的第一次尝试将索引放在错误的位置。industryIdentifiers是数组,所以把索引放在后面。

volumeInfo.industryIdentifiers[0].identifier

于 2013-01-24T17:32:39.033 回答