`

JSON.parse() & JSON.stringify()

 
阅读更多

原创转载请注明出处:http://agilestyle.iteye.com/blog/2352232

 

JSON.parse()

Demo 

var str = '{"username":"nodejs", "password":"23"}';

console.log(JSON.parse(str));

Console Output


 

JSON.stringify()

Demo 

var str = {a: 1, b: 2, c: "test"};

console.log(JSON.stringify(str));

Console Output


 

 

  • 大小: 3.5 KB
  • 大小: 3.2 KB
  • 大小: 32.7 KB
  • 大小: 53.8 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics