A search is presented for decays of Z and Higgs bosons to a J/ meson and a photon, with the subsequent decay of the J/ to +-. The analysis uses data from proton-proton collisions with an integrated luminosity of 35.9fb-1 at =13collected with the CMS detector at the LHC. The observed limit on the ZJ/ decay branching fraction, assuming that the J/ meson is produced unpolarized, is 1.4x10-6 at 95% confidence level, which corresponds to a rate higher than expected in the standard model by a factor of 15. For extreme-polarization scenarios, the observed limit changes from -13.6 to +8.6% with respect to the unpolarized scenario. The observed upper limit on the branching fraction for HJ/ where the J/ meson is assumed to be transversely polarized is 7.6x10-4, a factor of 260 larger than the standard model prediction. The results for the Higgs boson are combined with previous data from proton-proton collisions at =8TeV to produce an observed upper limit on the branching fraction for HJ/ that is a factor of 220 larger than the standard model value.