I am trying to join all of the data objects into one where they are all chained
var person1 = {
hello: {
"david": {
"hours": "44",
"money": "22"
}
}
};
var person2 = {
world: {
"pearce": {
"hours": "21",
"money": "11"
}
}
};
I want it to look like this:
var mergedObjects = {
hello: {
"david": {
"hours": "44",
"money": "22"
}
},
world: {
"pearce": {
"hours": "21",
"money": "11"
}
}
};
I know how to do this with Arrays, but how can i do this in javascript as a JSON object maintaining the correct structure