2017  Kodetalk | Feedback | Privacy Policy | Terms | About
userimage

Trying to converting a string JSON to Object JSON using jQuery $.parseJSON() but not working

Trying to converting a string JSON to Object JSON using jQuery $.parseJSON() but not working.


I have stored a string json in localStorage and after retrieve the same tried many way to convert the string JSON to Object json, but everytime i am failing.


JSON String : "{\"DAT1\":\"" + dat1+ "\",\"DAT2\":\"" + dat2+ "\",\"DAT3\":\"" + dat3+ "\",\"DAT4\":\"" + dat4+ "\"}"

Code used : $parseJSON(JSON.stringify(data string))


Now when i am trying to get the value using data.DAT1, everytime i am getting undefined as value.


What should i do?

userimage

Why dont you try JSON.parse() method as from jQuery 3.0 $.parseJSON is deprecated. Hope this will work for you.

Answer is