使用jquery获取对象名中带有#的json对象 我正在使用lastFm的recentracks api:

使用jquery获取对象名中带有#的json对象 我正在使用lastFm的recentracks api:,jquery,json,api,object,last.fm,Jquery,Json,Api,Object,Last.fm,www.last.fm/api/show?service=278 我使用这些来源了解如何使用它: api.jquery.com/jquery.getJSON/ www.hunlock.com/blogs/Mastering_JSON_%28_JavaScript_Object_Notation_%29 我正在获取json格式: ? 我想找回艺术家的名字 {"track":[{"artist":{"#text":"deadmau5","mbid":""} 从逻辑上讲,我会使用 item.

www.last.fm/api/show?service=278

  • 我使用这些来源了解如何使用它:
api.jquery.com/jquery.getJSON/

www.hunlock.com/blogs/Mastering_JSON_%28_JavaScript_Object_Notation_%29

  • 我正在获取json格式:
?

我想找回艺术家的名字

{"track":[{"artist":{"#text":"deadmau5","mbid":""}
从逻辑上讲,我会使用

item.artist.#text
总代码:

$.getJSON("http://ws.audioscrobbler.com/2.0/?method=user.getRecentTracks&user=melroymusic&api_key=690e1ed3bc00bc91804cd8f7fe5ed6d4&limit=5&format=json&callback=?",

function(data){
    $.each(data.recenttracks.track, function(i,item){
    $("#lastfmMenu").append("<div class='lastfmItem'><div class='lastfmText'>"+item.artist.#text+"</div>" + "<div class='lastfmDate'>"+item.name+"</div></div>");
    });
});
我不知道如何解决它,也找不到任何关于它的东西

看看这是怎么回事

提前感谢您,非常感谢

以下是jQuery的用法:

以下是jQuery的用法:


你试过物品了吗。美术师[“#文本”]你试过物品了吗。美术师[“#文本”]谢谢你,这很简单,我想@attr也是一样的:['@attr']是的,只需使用字符串访问这些属性。如果你认为它有效,别忘了把它标为已回答。谢谢谢谢你,这很容易,我想@attr也是如此['@attr']是的,只需使用字符串访问这些属性。如果你认为它有效,别忘了把它标为已回答。谢谢
 "@attr":{"nowplaying":"true"}
var json = {"track":[{"artist":{"#text":"deadmau5","mbid":""}]};

$.each(json.track, function (b, c) {
    console.log('Index' + b, c.artist['#text']); // index 0 deadmau5
});