var result = [{"id":"1","price":"20.46"},{"id":"2","price":"40.00"}] var userinputid = 1; result.forEach(function(e) { if (userinputid == e.id) alert(e.price); }); Run code snippet