A search is performed for Higgs-boson-mediated flavor-changing neutral currents in the decays of top quarks. The search is based on proton-proton collision data corresponding to an integrated luminosity of 19.7 fb−1 at a center-of-mass energy of 8 TeV collected with the CMS detector at the LHC. Events in which a top quark pair is produced with one top quark decaying into a charm or up quark and a Higgs boson (H), and the other top quark decaying into a bottom quark and a W boson are selected. The Higgs boson in these events is assumed to subsequently decay into either dibosons or difermions. No significant excess is observed above the expected standard model background, and an upper limit at the 95% confidence level is set on the branching fraction ℬ(t → Hc) of 0.40% and ℬ(t → Hu) of 0.55%, where the expected upper limits are 0.43% and 0.40%, respectively. These results correspond to upper limits on the square of the flavor-changing Higgs boson Yukawa couplings |λtcH|2 < 6.9 × 10− 3 and |λtuH|2 < 9.8 × 10− 3.