Partially working loc2json function.