JSON.parse()和JSON.stringify()

var str = '{"name":"小明","age":"10","sex":"男"}'

JSON.parse(str) 

结果:

Object
  1. name: "小明"
  2. age"10"
  3. sex: "男"
  4. __proto__Object

var str1 = {a:1,b:2}

JSON.stringify(str1)

结果:

{"a":1,"b":2}

原文地址:https://www.cnblogs.com/xuxml/p/8588283.html