Вы можете использовать метод Array.prototype.find:
var obj = {
data: [{
country: 'India',
capital: 'Delhi'
}, {
country: 'Pakisthan',
capital: 'Islamabad'
}, {
country: 'China',
capital: 'Beijing'
}, {
country: 'Bhutan',
capital: 'Thimphu'
}]
}
function getCapital(country, arr) {
return (arr.find(function(el) {
return el.country == country;
}) || {}).capital;
}
console.log(getCapital("India", obj.data)); // Delhi