  A search for the decays of the Higgs and $Z$ bosons to $J/\psi\gamma$ and
$\Upsilon(nS)\gamma$ ($n=1,2,3$) is performed with $pp$ collision data samples
corresponding to integrated luminosities of up to $20.3\mathrm{fb}^{-1}$
collected at $\sqrt{s}=8\mathrm{TeV}$ with the ATLAS detector at the CERN Large
Hadron Collider. No significant excess of events is observed above expected
backgrounds and 95\% CL upper limits are placed on the branching fractions. In
the $J/\psi\gamma$ final state the limits are $1.5\times10^{-3}$ and
$2.6\times10^{-6}$ for the Higgs and $Z$ boson decays, respectively, while in
the $\Upsilon(1S,2S,3S)\,\gamma$ final states the limits are
$(1.3,1.9,1.3)\times10^{-3}$ and $(3.4,6.5,5.4)\times10^{-6}$, respectively.
