Measurements are presented of the CP violation observables S and C in the decays of B0 and B¯0 mesons to the J/ψKS0 final state. The data sample corresponds to an integrated luminosity of 3.0fb-1 collected with the LHCb experiment in proton-proton collisions at center-of-mass energies of 7 and 8 TeV, and contains a total of 41560 selected B0 and B¯0 decays. The analysis of the time evolution of these decays yields S=0.731±0.035(stat)±0.020(syst) and C=-0.038±0.032(stat)±0.005(syst). In the standard model, S equals sin(2β) to a good level of precision. The values are consistent with the current world averages and with the standard model expectations.