1
我想遍歷一個JSON數組以達到size:large
的URL。 #text
屬性讓我感到困惑,因爲我無法將它包含在我的點符號中。我能到size=large
與此:Json解析#text對象
json.track.album.image[2].size
但json.track.album.image[2].#text
將無法正常工作。
這裏是JSON數據的一個片段:
{"track":{"id":"1019817","name":"Believe","mbid":"13194c93-89c6-4ab4-aaf2- 15db5d73b74e","url":"http:\/\/www.last.fm\/music\/Cher\/_\/Believe","duration":"222000","streamable":{"#text":"1","fulltrack":"0"},"listeners":"287271","playcount":"1206650","artist":{"name":"Cher","mbid":"bfcc6d75-a6a5-4bc6-8282-47aec8531818","url":"http:\/\/www.last.fm\/music\/Cher"},"album":{"artist":"Cher","title":"The Very Best of Cher","mbid":"5df00011-6e57-4837-99ae-61f398481db5","url":"http:\/\/www.last.fm\/music\/Cher\/The+Very+Best+of+Cher","image":[{"#text":"http:\/\/userserve-ak.last.fm\/serve\/64s\/71997588.png","size":"small"},{"#text":"http:\/\/userserve-ak.last.fm\/serve\/126\/71997588.png","size":"medium"},{"#text":"http:\/\/userserve-ak.last.fm\/serve\/174s\/71997588.png","size":"large"},{"#text":"http:\/\/userserve-ak.last.fm\/serve\/300x300\/71997588.png","size":"extralarge"}],
謝謝詹姆斯。就像所有JS一樣,答案總是很簡單,但是到達那裏...... – hillcreative