Reputation: 1
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/ v"
Upvotes: 0
Views: 614
Reputation: 359946
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'
Upvotes: 1
Reputation: 816730
In this case you have to use bracket notation to access the property:
var value = obj['No.']; // obj['referring domain or url'], etc.
Upvotes: 1