I have two JSON objects that I want to merge in such a way that only the values of the properties in the first object that already exist are updated.
I want to extend the first object with the second
var obj1 = {a:'apple', b:'banana', c:'cucumber'};
var obj2 = {a:'aarbei', b:'beet', d:'durian'};
and get this result
{a:'aarbei', b:'beet', c:'cucumber'};
instead of (which I get using $.extend)
{a:'aarbei', b:'beet', c:'cucumber', d:'durian'};
In reality my JSON objects can be much bigger and contain nested objects/arrays of unknown complexity