0

I'm using the jQuery template plugin to display JSON info from Google Books API to produce a book list here: http://jsfiddle.net/yuW6L

I can get and display basic info like the title from the JSON with the template tags

{{each items}}

and

${volumeInfo.title}

But the ISBN is nested in a portion of the JSON that looks like this:

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

I can't display the ISBN-10 this way:

volumeInfo.industryIdentifiers.identifier[1]

I don't think I can do this:

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

What's the way to parse and display the ISBN-10?

nathanbweb
  • 717
  • 1
  • 11
  • 26
  • 1
    possible duplicate of [I have a nested data structure / JSON, how can I access a specific value?](http://stackoverflow.com/questions/11922383/i-have-a-nested-data-structure-json-how-can-i-access-a-specific-value) – Felix Kling Jan 24 '13 at 17:34
  • mine is using the jQuery template plugin – nathanbweb Jan 24 '13 at 17:41
  • Which you should probably not use anymore anyways, because it is an abandoned project. It doesn't matter much though, the rules for access object properties are the same, only the entry point would change when you use `each`. If you really need a demo for `each` though, have a look at this example: http://jquery.github.com/jquery-tmpl/demos/step-by-step/0_tmpl-read-only/4_each-tag.html. The official documentation does not seem to exist anymore. – Felix Kling Jan 24 '13 at 17:43

1 Answers1

1

Your first try has the index at the wrong location. industryIdentifiers is the array, so place the index after that.

volumeInfo.industryIdentifiers[0].identifier

Jesse Jashinsky
  • 10,313
  • 6
  • 38
  • 63
  • @nathanbweb: See, the question I linked to also explained how to access arrays (and more)... it's a duplicate after all ;) – Felix Kling Jan 24 '13 at 17:48