javascript:如何应对@&引用;及&引用;Json格式
有一个json数据:javascript:如何应对@&引用;及&引用;Json格式,javascript,json,Javascript,Json,有一个json数据: var json = { "entry" : [{ "category" : { "@scheme" : "http:\/\/www.douban.com\/2007#kind", "@term" : "http:\/\/www.douban.com\/2007#movie" }, "title" : { "$t" : "Real Ste
var json = {
"entry" : [{
"category" : {
"@scheme" : "http:\/\/www.douban.com\/2007#kind",
"@term" : "http:\/\/www.douban.com\/2007#movie"
},
"title" : {
"$t" : "Real Steel"
},
"db:attribute" : [{
"$t" : "USA",
"@name" : "country"
}]
}]
}
警报(json.entry[0].title.$t)
可以打印“真钢”。然而,
如何在Javascript中获取http:\/\/www.douban.com\/2007#kind
和USA
?
它包含
@
和:
,我不知道如何处理它。使用方括号和字符串而不是
json.entry[0].category["@scheme"]
json.entry[0].category["@term"]
json.entry[0]["db:attribute"][0].$t
json.entry[0]["db:attribute"][0]["@name"]
使用方括号和字符串代替
json.entry[0].category["@scheme"]
json.entry[0].category["@term"]
json.entry[0]["db:attribute"][0].$t
json.entry[0]["db:attribute"][0]["@name"]
如果我理解正确,您可以执行以下操作:
json.entry[0].category["@scheme"]
如果我理解正确,您可以执行以下操作:
json.entry[0].category["@scheme"]