Friday, 31 August 2012

Parsing JSON w/ @ symbol in it

To read the json response like bellow @ concatenated with attribute 
                           '{ "@id": 1001, "@name": "Sony", "edu": "MCA" }'
Usually we do use alert(data.edu); to get the values but when @ is with attribute then use the bellow code

 var attName = data['@id'];
 alert(attName);

      or

 var att = '@name';
 var attID = data[att];

 alert(data.edu);




Tags: @ in json, @ symbol in json response, Parsing JSON with @ symbol in it.

No comments:

Post a Comment

Parsing JSON w/ @ symbol in it

To read the json response like bellow @ concatenated with attribute                             '{ "@id": 1001, "@name&q...