The Lord Jesus Christ's human blood-line included some very disappointing characters. King David should never have fathered Solomon: the king committed adultery with the boy's mother and had her husband killed. Solomon’s only son Rehaboam encouraged people to worship idols and the nation was split in two. Abijah gave the impression of being godly but did not truly worship the Lord. Asa served the Lord for the first 35 years of his reign but turned against the Lord in the last 5 years. However his son Jehoshophat wanted to honour the Lord although he made some bad decisions and compromised his faith.
Jehoram brutally murdered his brothers and reigned wickedly. Uzziah was an effective king until he became proud and God struck him with leprosy. Jotham was a good king but was unable to lead the people to love the Lord. Ahaz was wicked throughout his reign; but his son Hezekiah was a godly man. But Manasseh worshipped idols and practised witchcraft, and his son Amon was worse. Josiah was very different; he loved the Lord and established major spiritual reforms. However, it was Jeconiah's sin that finally tipped Israel into exile in Babylon.
You may think, how could God choose such wicked people to be the human ancestors of the Christ? The answer is that their sins were the reason why Jesus had to come to die. Matthew probably saw his previously corrupt lifestyle mirrored in this list. And yet Matthew knew the freedom of forgiveness through Jesus' death. God chooses flawed people to achieve His purposes and Matthew was glad, and so should we be glad – otherwise none of us would have any hope. So we should be encouraged that there is no sin so bad that God cannot use us and work out His purpose through us. Of course, He wants us to repent and cooperate with Him like Josiah and Hezekiah (they were greatly blessed by God), but He has the power to achieve His plan even through evil people (although they will face His judgement).