since we have both in the family i will try to make a fair comparison
firstly the d22 in 2002 costed me the same amount of money i would have to pay today for a d40 v6 new, and back then money was far more harder to gather than now so its not a price comparison to me
in the d22 i have used it to tend my fields i got from my father at weekends (i work in a siemens factory but i have some olive oil trees and produce my own wine) and i have loaded the truck up to 1500 kgs on stock suspension without a problem, never had clearance problem and i just hate new cars electronics, i mean bluetooth or auto wipers and auto lights are useless to me, i have them in my daily driver and hate them
in the our 2009 d40 (my brothers) which is the 140kw version it clearly has more power, better seats as stated and coil overs are just better than torsions bars, but in work might want to do it had limitations from the front stock bumper, its just too low ! we havent really loaded it as far as our d22 but does well obviously but we both hate this "upgrade" of the 4wd being on a silly button, why did they remove the stick for the love of god.... we are on our second 4wd switches.... also we had a bearing problem, unlike the old fashioned d22 pushed one which are far more reliable and do the exact same work so they are better, its those upgrades that make the d40 look "little"
i cant compare the cabin space mine is a king cab my brothers is double.
on the upside the d40 can get a suspension lift much cheaper with front coil spacers and extended shacles, the d22 would need a torsion bar otherwise you will wound it up and destroy it in 2-3 years.
overall we love both and we will keep both for many many years (we still have our dad 1985 4wd nissan 720 around 600,000 kms on the clock running like new
)
far better trucks than a hilux or a isuzu or a ford-mazda..... the 2005- l200 is just laughable i liked the 1997-2004 model far more