Because if you know God. Then you know that you are wrong. They Judged themselves because they knew it was wrong. So Jonah just put a spotlight before Judgement would fall. So of course they repented.