If you don't mind finding a different speedo solution, then it is a viable swap.
The only concern with compatibility aside from that is if it is an np242HD (mated to the V8 models) or an np242j (mated to the 4.0L models). Although both were offered on the WJ, you cannot narrow down the input shaft/spline count unless you figure out which engine it was used for. Also, make sure it isn't a np249 which was a full-time 4wd transfer case (non-2wd) also offered in the WJ.
So if you can figure out what year WJ with what transmission it came out of, you can narrow down whether it will fit or not. For reference, my transfer case was originally out of an '00 XJ with an AW-4 automatic transmission, and it went into my TJ with an nv3550; it had a short input shaft and was a 23 spline.
So if it came out of a 4.0L it will work, but it will not work out of a v8 model. Specifically, I believe your transmission (nv3550) will work with both a 23-spline short-input and a 23-spline medium-input, but it will not work with a long-input shaft because it will supposedly destroy the transmission. If it is a np242HD it will have a long input shaft, and therefore will not work because it can destroy your transmission.
Also, it must be from a '95 or newer 4.0L WJ because the spline count & gear tooth design changed.