Trippal,
var options = {
service:"Open Street Map",
drawStyleOptions : {
color: "blue",
weight: 1,
opacity: 0.65,
},
osmSearchOptions:{
name: "Oper Street Map",
url: "http://nominatim.openstreetmap.org/search.php?",
urlOptions:{
q: "",
format:"json",
limit:10
}
},
yandexSearchOptions:{
name: "Yandex",
url: "https://geocode-maps.yandex.ru/1.x/?",
urlOptions:{
geocode:"",
format:"json"
}
},
googleSearchOptions:{
name: "Google",
url: "https://maps.googleapis.com/maps/api/geocode/json?",
urlOptions:{
address: "",
limit:10
}
}
};
function fn(obj, value)
{
var elem = null;
Object.keys(obj).forEach(function (key) {
if(typeof obj[key] == "object") {var a = fn(obj[key], value); a && (elem = a)}
else if (obj[key] == value) elem = obj;
});
return elem
}
var a = fn(options,"Oper Street Map")
alert(JSON.stringify(a));
a = fn(options,"Google")
alert(JSON.stringify(a));