Json解析#文本对象

Json解析#文本对象,json,parsing,Json,Parsing,我试图遍历一个JSON数组,以到达size:large的URL。#text属性让我感到困惑,因为我无法将其包含在点表示法中。我可以通过以下方法获得size=large: json.track.album.image[2].size 但是json.track.album.image[2]。#text不起作用 以下是JSON数据的一个片段: {"track":{"id":"1019817","name":"Believe","mbid":"13194c93-89c6-4ab4-aaf2-

我试图遍历一个JSON数组,以到达
size:large
的URL。
#text
属性让我感到困惑,因为我无法将其包含在点表示法中。我可以通过以下方法获得
size=large

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"}],

由于前面的
#
,因此必须使用
[]
语法:

json.track.album.image[2]['#text']
这允许您将密钥指定为字符串,因此允许使用特殊字符