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

json 合并

时间:2016-12-10 09:37:48      阅读:170      评论:0      收藏:0      [点我收藏+]

标签:highlight   str   asc   console   javascrip   gif   script   json   ace   

 var o1 = {a:1,b:3,c:3},o2 = {b:5,c:4,d:6};
              a = eval("("+(JSON.stringify(o1)+JSON.stringify(o2)).replace(/}{/,",")+")");
            console.log(a)

 结果为:Object {a: 1, b: 5, c: 4, d: 6}

json 合并

标签:highlight   str   asc   console   javascrip   gif   script   json   ace   

原文地址:http://www.cnblogs.com/silvacheng/p/6154792.html

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