Asteroids' and comets' geodesy is of increasing interest in a wide range of fields ranging from astronomy to potential future mining prospects, as well as being essential to successful proximity operations of spacecraft. However, the problem of inferring the internal density distribution of irregular bodies from gravity measurements is challenging and ill posed, with the added difficulty of finding compact representations of the gravitational field surrounding them. We present a novel approach based on artificial neural networks, socalled geodesyNets, and present compelling evidence of their ability to serve as accurate geodetic models of highly irregular bodies using minimal prior information on the body. The approach does not rely on the body shape information but, if available, can harness it. GeodesyNets learn a three-dimensional, differentiable, function representing the body density, which we call neural density field. The body shape, as well as other geodetic properties, can easily be recov-1