NMR spectroscopy serves as one of the most commonly used detection techniques with non-invasive properties. Particularly, 2D homonuclear J-resolved NMR spectroscopy, revealing chemical shifts and J couplings along two independent dimensions, has been widely applied to molecular conformational elucidation, metabolite analysis and in vivo study. However, conventional 2D J-resolved experiments generally suffer from two intrinsic issues, namely the long acquisition duration, which confines the experimental efficiency and hyper-dimensional NMR spectroscopy development, and the effect of magnetic field inhomogeneity, which hinders direct extraction of structure information in biological tissues characterized with intrinsic magnetic susceptibility variations and abundant metabolites. Therefore, we propose a general single-scan NMR method, SGEN-J, to real-time record high-resolution 2D homonuclear J-resolved spectra under inhomogeneous fields. This proposed NMR method is designed based on the combination of a selective gradient encoding module to encode chemical shifts with spatial positions, and a J-modulation decoding module to reveal encoded structural information. Experimental results on chemical samples demonstrate that the SGEN-J offers an effective tool for molecular structure elucidation with ultrafast acquisition efficiency (about one second), decent potentiality for quantitative measurements, and intrinsic tolerance to field inhomogeneity. Experimental results on pig marrow indicate that the SGEN-J is applicable to rapidly detecting biological tissues with intrinsic susceptibility variations, without complicated NMR hardware requirement (e.g. magic angle spinning technique) and specialized sample preparation (e.g. tissue extraction). Multi-band SGEN-J is further implemented to effectively enhance spectral sensitivity with sustained tolerance of field inhomogeneity. The SGEN-J may serve as a useful complement to existing 2D J-resolved methodologies in molecular structure elucidation and biomedical study, and offer bright perspectives for real-time metabolite analysis and in vivo study.