Murtaza Khursheed Hussain Murtaza Khursheed Hussain - 11 months ago 37
jQuery Question

Merge two json/javascript arrays in to one array

I have two json arrays like

var json1 = [{id:1, name: 'xxx' ...}]
var json2 = [{id:2, name: 'xyz' ...}]

I want them merge in to single arrays

var finalObj = [{id:1, name: 'xxx' ...},{id:2, name: 'xyz' ...}]



You want the concat method.

var finalObj = json1.concat(json2);