How does JSON.parse() work?

后端 未结 4 1921
渐次进展
渐次进展 2021-02-06 09:03

I have not worked too much on javascript. And, I need to parse a JSON string. So, I want to know what exactly JSON.parse does. For example : If I assign a json string to a varia

4条回答
  •  后悔当初
    2021-02-06 09:43

    Your 'ab' variable isn't a string, it is a proper javascript object, since you used the {} around it. If you encased the whole thing in "" then it would be a string and would print out as a single line.

提交回复
热议问题