Skip to content

Instantly share code, notes, and snippets.

@Silom
Created February 7, 2014 12:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Silom/8861774 to your computer and use it in GitHub Desktop.
Save Silom/8861774 to your computer and use it in GitHub Desktop.
This dist shows you how to merge endless json objects in JavaScript.
function merge(json) {
var sources = [].slice.call(arguments, 1);
sources.forEach(function (source) {
for (var property in source) {
json[property] = source[property];
}
});
return json;
}
// merge(json1, json2, json3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment