码迷,mamicode.com
首页 > Web开发 > 详细

json对象的处理

时间:2016-06-30 19:55:33      阅读:182      评论:0      收藏:0      [点我收藏+]

标签:

  • 不同的服务器接受的json对象要处理
  • var str1 = ‘{"name": "Lucy", "age": 23}‘;
    var str2 = {a:1, b: "Jack"};
    var a = JSON.parse(str1)        //将字符串转换为json对象
    var b = JSON.stringify(str2)    //将对象解析为字符串
    console.log(a, typeof(str1), typeof(a));    
    console.log(b, typeof(str2), typeof(b));

     

json对象的处理

标签:

原文地址:http://www.cnblogs.com/leijiuling/p/5630956.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!