[Vuejs]-Vue looping nested JSON troubles

1👍

You should be using:

<b-img v-if="res.volumeInfo.imageLinks" :src="res.volumeInfo.imageLinks.smallThumbnail"></b-img>

Instead of

<b-img :src="res.volumeInfo.imageLinks.smallThumbnail"></b-img> 

0👍

Okay, the problem is that the JSON file is totally mixed. Not every instance has imageLinks, and the amount of nested data varies. That’s why the loop breaks when it encounters a nest that does not have “imageLinks”. The JSON file is intentionally shuffled to make life (and programming) a bit harder.

Leave a comment