Let's expand this question and ask, did anyone who died in the Salem witch trials deserve to die? The people that died were innocent of the charge that they were murdered for--they were not witches, and even though I'm sure all of them had their faults, none of those faults warranted a cruel and painful death at the end of a noose. John had more faults than many others--he had committed what was considered to be an awful sin in the Puritan community, adultery. However, confession and excommunication would have been the worst that he would have had to suffer if he was punished for that crime. So, what did John do that warranted his death? Nothing. In fact, the people that did die could be said to be even more honest and god-fearing people than those that confessed to witchcraft to save their necks. The people that confessed betrayed their integrity by lying, while those that died did not lie.
John's death was not deserved, nor were the deaths of the other 18 people that ended up getting hanged. Eventually, all of the people of Salem realized that these were unjust killings, and did what they could to care for the impoverished families. Descendents of the victims were even compensated by the state many years later in an attempt to recompense them for the damage that was done. To say that John's death was deserved is to say that anyone who has ever done anything wrong should be killed, and at the hands of an unfair and suspicious court, at that. John died as an unusual hero, who cared more about living honestly and maintaining his reputation than giving in to lies and a deceitful court. I hope that helps--good luck!