Looking at them, the ZF4HP24 is a little longer than the 22, this accomodated by a shorter extension piece between the gearbox and transfer box. Everything else seems to be the same but you may have to swap the torque convertor housing (bell housing)
The 24 has a higher torque rating so should be better, the 22 is marginal on the diesel.
If you manage to do it I would be interested in how it goes, it is something I have been considering.