When I receive the JSON object from the last.fm API, it looks like this:
{
"artists": {
"artist": {
"name": "Daft Punk",
"playcount": "494599",
"listeners": "106101",
"mbid": "056e4f3e-d505-4dad-8ec1-d04f521cbb56",
"url": "http://www.last.fm/music/Daft+Punk",
"streamable": "1",
"image": [
{
"#text": "http://userserve-ak.last.fm/serve/34/5463.jpg",
"size": "small"
},
{
"#text": "http://userserve-ak.last.fm/serve/64/5463.jpg",
"size": "medium"
},
{
"#text": "http://userserve-ak.last.fm/serve/126/5463.jpg",
"size": "large"
},
{
"#text": "http://userserve-ak.last.fm/serve/252/5463.jpg",
"size": "extralarge"
},
{
"#text": "http://userserve-ak.last.fm/serve/500/5463/Daft+Punk.jpg",
"size": "mega"
}
]
},
"@attr": {
"page": "1",
"perPage": "1",
"totalPages": "1000",
"total": "1000"
}
}
}
I want to extract the image URLs from the object, but the key for the URLs is "#text"
. I'm not sure how to access a value with "#" in the key using Javascript. I am currently using AngularJS, but suggestions using plain JavaScript would be helpful as well. Does anyone know how I can retrieve the value associated with "#" in the object key?
Any guidance on this issue would be highly appreciated.
Thanks!