<textarea id="test" rows="30" cols="100">
</textarea>
var arrayObj = [
{
animals: {
cat: {
voice: 'meow',
other: {
name: 'Tom'
}
},
dog: {
voice: 'gav'
}
}
},
{
animals: {
cat: {
tail: true
},
dog: {
eyes: 'two'
}
}
}
]
// var result = {
// animals: {
// cat: {
// voice: 'meow',
// other: {
// name: 'Tom',
// },
// tail: true,
// },
// dog: {
// voice: 'gav',
// eyes: 'two',
// }
// }
// }
document.getElementById('test').value = JSON.stringify(_.merge(arrayObj[0], arrayObj[1]),null, 2);
This Pen doesn't use any external CSS resources.