Convert string to JSON Object

前端 未结 7 1587
梦如初夏
梦如初夏 2020-12-09 01:57

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.

7条回答
  •  天命终不由人
    2020-12-09 02:46

    Quick answer, this eval work:

    eval('var obj = {"TeamList" : [{"teamid" : "1","teamname" : "Barcelona"}]}')
    

提交回复
热议问题