Issue in accessing JSON object?

Posted by Esh on Stack Overflow See other posts from Stack Overflow or by Esh
Published on 2012-09-07T09:32:57Z Indexed on 2012/09/07 9:37 UTC
Read the original article Hit count: 203

Filed under:
|
|

Am facing issue in accessing the JSON object : JSON Object am receiving is :

{"71":"Heart XXX","76":"No Heart YYYY"}

I tried to get the value of 71 and 72 separately and use it ...

but am getting some compile time issue as : Syntax error on token ".71", delete this token

Code:

var map=$("#jsonText").val();
    alert(map);
    var  obj=jQuery.parseJSON(map);
    alert("JSON ::"+obj.71);

If am printing obj , am able to view [Object Object]

Can any one out there please help me to find the mistake i did ..I know the question above is asked in many threads in SO . Below are the few threads i found , but failed when i attempted to implement it ..

jquery json parsing

Also tried using the Jquery tutorial given in

Jquery JSON

Its working fine if the key is a String but getting the above error if its a number ...

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery