We report results on deep Jansky Very Large Array (VLA) A-configuration observations at 22 GHz of the hotspots of the radio galaxies 3C 227 and 3C 445. Synchrotron emission in the optical on scales up to a few kpc was reported for the four hotspots. Our VLA observations point out the presence of unresolved regions with upper limit to their linear size of about 100 pc. This is the first time that such compact components in hotspots have been detected in a mini-sample, indicating that they are not a peculiar characteristic of a few individual hotspots. The polarization may reach values up to 70 per cent in compact (about 0.1 kpc scale) regions within the hotspot, indicating a highly ordered magnetic field with size up to a hundred parsecs. On larger scales, the average polarization of the hotspot component is about 30-45 per cent, suggesting the presence of a significant random field component, rather than an ordered magnetic field. This is further supported by the displacement between the peaks in polarized intensity and in total intensity images that is observed in all the four hotspots. The electric vector position angle is not constant, but changes arbitrarily in the central part of the hotspot regions, whereas it is usually perpendicular to the total intensity contours of the outermost edge of the hotspot structure, likely marking the large-scale shock front. The misalignment between X-ray and radio-to-optical emission suggests that the former is tracing the current particle acceleration, whereas the latter marks older shock fronts.