The magnetic field of Jupiter is largely due to a core of metallic hydrogen, which exists due to the high core pressures at Jupiter’s center. Same would apply for any other gas giant of similar structure. Might also apply for brown dwarves, however there are higher core temperatures due to gravitational contraction (plus any short lived fusion reaction, either involving deuterium and/or lithium). So that further reinforces the molten core of terrestrial planets (Mars may have lost its field due to the core cooling to the point of no longer being liquid).
The ocean theory could explain why Venus has no magnetic field, despite being almost the same size and composition as Earth.