I'm quite new to json/jQuery and javascript so I may be doing something glaringly stupid, so go easy on me. Also, I HAVE looked at questions asking similar things to what I'm asking, but I couldn't seem to get any of them to work for me.
What I am trying to do, is call json data from an API and get the "image.full" property for each object. The included JSfiddle shows what I am trying to accomplish, although I have statically assigned to get the image of a single character(object) "Aatrox" in this case. I have supplied sample data for two characters(objects) "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: How can I loop through and get the "image.full" property of each object within data (ie: Thresh, Aatrox)? Also, I realize my API key is shown in this question, so I will be getting a new one after this is sorted out. :)
Any help is greatly appreciate, thanks.