Factorize conversion of JSON or Python to axes.