JQuery: Join JSON arrays

The simplest way to merge JSON arrays usning JQuery is to use the concat function.


var json1 = [{id: 1, name: "one"}];
var json2 = [{id: 2, name: "two"}, {id: 3, name: "three"}];
var finalObj = json1.concat(json2);

Here finalObj will contain an array of 3 objects:
[{id: 1, name: “one”},{id: 2, name: “two”}, {id: 3, name: “three”}]