Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我曾经$.getJSON()从 json api 获取数据。它返回一个普通对象。我试图从这样的对象中获取特定值:data.topartists.artist[0].image[4].#text. 这会Uncaught SyntaxError: Unexpected token ILLEGAL导致#. 有什么方法可以逃脱,#以便我可以从键中获取值#text?
$.getJSON()
data.topartists.artist[0].image[4].#text
Uncaught SyntaxError: Unexpected token ILLEGAL
#
#text
你需要使用括号表示法
data.topartists.artist[0].image[4]['#text']