Trippal, не совсем понятно условие задачи ...
var options = {
key1:"value1",
key2:"value2",
key3:{
key31:"value31",
key32:"value32"
},
key4:{
key41:"value41",
key42:"value42"
}
}
function fn(obj, value)
{
var elem = null;
Object.keys(obj).forEach(function (key) {
if(typeof obj[key] == "object") elem = fn(obj[key], value);
else if (obj[key] == value) elem = obj;
});
return elem
}
var a = fn(options,"value42")
alert(JSON.stringify(a));