Scalar couplings of the form JI(1) x I(2) between nuclei impart valuable information about molecular structure to nuclear magnetic-resonance spectra. Here we demonstrate direct detection of J-spectra due to both heteronuclear and homonuclear J-coupling in a zero-field environment where the Zeeman interaction is completely absent. We show that characteristic functional groups exhibit distinct spectra with straightforward interpretation for chemical identification. Detection is performed with a microfabricated optical atomic magnetometer, providing high sensitivity to samples of microliter volumes. We obtain 0.1 Hz linewidths and measure scalar-coupling parameters with 4-mHz statistical uncertainty. We anticipate that the technique described here will provide a new modality for high-precision "J spectroscopy" using small samples on microchip devices for multiplexed screening, assaying, and sample identification in chemistry and biomedicine.