var json1 = { name: 'jack' }; var json2 = { age: 18}; var json3 = JSON.parse((JSON.stringify(json1) + JSON.stringify(json2)).replace(/}{/, ',')); console.log(json3); //{name: "jack", age: 18}
var json1 = { name: 'jack' }; var json2 = { age: 18}; var json3 = JSON.parse((JSON.stringify(json1) + JSON.stringify(json2)).replace(/}{/, ',')); console.log(json3); //{name: "jack", age: 18}
转载于:https://www.cnblogs.com/webmc/p/11095642.html