The high-resolution x-ray-scattering technique is used to study the elastic scattering of atoms and molecules in the gas phase. The elastic squared form factor, which is the square of the Fourier transformation of the electron density distribution in position space and reveals the pure electronic structure of atoms and molecules in the ground state, of molecular hydrogen is measured at an incident photon energy of about 9889 eV and an energy resolution of about 70 meV. Although it is generally thought that the x-ray-scattering technique is identical to high-energy electron scattering, at least for elastic scattering these two techniques have an apparent difference, i.e., the pure electronic structure of a molecule in the ground state can be determined by x-ray scattering while it cannot be obtained by the high-energy electron impact method due to the interference between the scattering of separate nuclei and of the electrons in the target. The present experimental results match the theoretical calculations very well, which demonstrates that high-resolution x-ray scattering is a powerful tool to study the electronic structure of atoms and molecules in the ground state.