How do I convert string to object? I am facing this problem because I am trying to read the elements in the JSON string using "each".
My string is given below.
jsonObj = "{"TeamList" : [{"teamid" : "1","teamname" : "Barcelona"}]}"
I have used eval
and I have used
var obj = $.parseJSON(jsonObj);
And i have also used
var obj= eval("(" + jsonObj + ")");
But it comes null all the time
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…