var a={
first:{
first:'root->first->second'
},
second:'root->second'
},
property_name='first.first';
function get_object_property(object,property){
if(typeof object!=='object')
throw new Error('Invalid input data');
property=property.split('.');
for(var i in property){
if(!property.hasOwnProperty(i))
continue;
var pr_name=property[i];
if(object[pr_name])
object=object[pr_name];
else
return null;
};
return object;
}
alert(get_object_property(a,property_name));