I'm using the Last.fm API to return data in JSON format and this works fine. I'm using the user.getTopArtist() API call.
As the page loads, a DIV object is created for each artist containing relevant details from the JSON data. When a user performs an action with the DIV I basically want to swap the image url to show a bigger image size!
How can I find/reference a JSON object by matching it's stored value?
For example, if I need to match the artist name 'Kate Bush' and then retrieve the "extralarge" image url. How would I do this?
The data structure looks like this:
{"topartists":{
"artist":[{
"name":"Kate Bush",
"playcount":"20",
"mbid":"4b585938-f271-45e2-b19a-91c634b5e396",
"url":"http:\/\/www.last.fm\/music\/Kate+Bush",
"image":[
{"#text":"http:\/\/userserve-ak.last.fm\/serve\/34\/224740.jpg","size":"small"},
{"#text":"http:\/\/userserve-ak.last.fm\/serve\/64\/224740.jpg","size":"medium"},
{"#text":"http:\/\/userserve-ak.last.fm\/serve\/126\/224740.jpg","size":"large"},
{"#text":"http:\/\/userserve-ak.last.fm\/serve\/252\/224740.jpg","size":"extralarge"},
{"#text":"http:\/\/userserve-ak.last.fm\/serve\/500\/224740\/Kate+Bush.jpg","size":"mega"}
]
}
}