$.getJSON return array object has special characters
My coding returns the json array and the object has special characters which i am not able to retrieve the data in my coding.
Example:
{ "No." : "3",
"sign" : "positive",
"nr_old" : "",
"referring domain or url":"www.google.co.za",
"visits" : "1",
"avg. pv/ v" :"4.0",
"graph" : ""
}
In the above example, i am not able to retrieve "No." and "referring domain or url" and "avg. pv/ 开发者_StackOverflow中文版v"
In this case you have to use bracket notation to access the property:
var value = obj['No.']; // obj['referring domain or url'], etc.
Use bracket notation.
data = {
"No." : "3",
"sign" : "positive",
"nr_old" : "",
"referring domain or url":"www.google.co.za",
"visits" : "1",
"avg. pv/ v" :"4.0",
"graph" : ""
}
data['No.'] // '3'
data['avg. pv/ v'] // '4.0'
data['referring domain or url'] // 'www.google.co.za'
精彩评论