[英]How can I access JSON.@attribute from an XML Converted on Javascript
I got a JSON converted from XML. 我从XML转换了JSON。
So, how can I get json.@attribute.something
. 那么,我怎样才能获得
json.@attribute.something
。
@
<-- this one will make javascript error @
< - 这个会导致javascript错误
I use Javascript. 我用Javascript。
Making a great exercise of imagination, I suppose you've used jQuery to download some JSON through AJAX and you have an object with a key called "@attribute", such as this: 想象力很好,我想你已经使用jQuery通过AJAX下载了一些JSON,并且你有一个带有一个名为“@attribute”的键的对象,例如:
var foo = {
"@attribute": 33
}
You just need to use square brackets: 你只需要使用方括号:
console.log(foo["@attribute"])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.