Admittedly, I'm fairly new to json/jQuery and JavaScript, so please bear with me if I make any obvious mistakes. Despite looking at similar questions, none of the solutions seemed to work for me.
My goal is to retrieve the "image.full" property for each object by calling JSON data from an API. The JSfiddle example demonstrates what I am attempting to achieve, although I have currently hardcoded to retrieve the image of a singular character(object) "Aatrox". Sample data has been provided for two characters(objects) named "Thresh" and "Aatrox".
Sample JSON Data:
{
"data": {
"Thresh": {
"id": "Thresh",
"title": "the Chain Warden",
"name": "Thresh",
"image": {
"w": 48,
"full": "Thresh.png",
"sprite": "champion3.png",
"group": "champion",
"h": 48,
"y": 0,
"x": 48
},
"key": "412"
},
"Aatrox": {
"id": "Aatrox",
"title": "the Darkin Blade",
"name": "Aatrox",
"image": {
"w": 48,
"full": "Aatrox.png",
"sprite": "champion0.png",
"group": "champion",
"h": 48,
"y": 0,
"x": 0
},
"key": "266"
},
HTML:
<div class="container-fluid">
<div class="row" id="champs"></div>
</div>
jQuery:
$.getJSON('https://prod.api.pvp.net/api/lol/static-data/na/v1/champion? champData=image&api_key=7d315bdf-c456-4792-b5d6-eadc7ef1672f', function (json) {
var image = json.data.Aatrox.image.full;
$('#champs').append('<div class="col-xs-4 col-md-1"><img src="http://ddragon.leagueoflegends.com/cdn/4.3.18/img/champion/' + image + '"/></div>');
});
JSFIDDLE: http://jsfiddle.net/8S8LZ/2/
Question Summary: My query involves looping through and retrieving the "image.full" property of each object within the data (e.g., Thresh, Aatrox). I acknowledge that my API key is visible in this question, and I will replace it once this issue is resolved. :)
Your assistance would be greatly appreciated. Thank you.