With the volume and mass of a planet concludes are possible of its material composition. But there is more, for example auroras been observed at Jupiter. This is only possible if Jupiter has a magnetic field just like our earth. A magnetic field is a strong evidence for an iron core.
The next point is, heavy materials accumulate in the center, so one could ask why there isn’t gold or even heavier stuff in the core of a planet. The most common material in the universe is hydrogen. Hydrogenis burned through atomic fusion into helium. All heavier materials are produced if a star dies in an explosion. So really heavy materials like gold are less likely and iron or nickel are more common so cores more likely made of these materials.