I'm a bit of a novice with JSON. I'm working on building an events page using the JSON feed from last.fm.
The feed is working fine, but the issue is when multiple artists come across for the same event, such as a music festival. Right now the whole array is printing out with no spaces after the commas, and I can't figure out how to shorten the array if many bands are listed. (list the first ten bands, for example.)
The relevant part of my code is
$.getJSON(last_fm_url, function(data) {
$.each(data.events.event, function(i, item){
var eventTitle = item.title;
var eventArtist = item.artists.artist;
});
});
eventTitle is no big deal since there's only one, but I'm not sure what to do with eventArtist, how to separate that long list into individual items I can work with.
My sample is here: http://bit.ly/ZI4Q5h. My jsfiddle is here: http://jsfiddle.net/SBvUm/2/.
Thank you for your help.