Rooting Samsung 7J prime


I am having trouble with rooting a Samsung 7J prime I am on an AT&T network but the phone was originally Metro PCS on T-Mobile. I need to root it to put the M-Spy software on it. can this phone be rooted if so what do I need to do.

Thanks for any help that you can give me.