var json1 = {
a:1,
b:2
}
var json2 = {
c:3,
d:4
}
var json = mergeObject(json1, json2);
//result
{
a:1,
b:2,
c:3,
d:4
}
function mergeObject(destination, source) {
for (var property in source)
destination[property] = source[property];
return destination;
}
评论 (0)