Why does God say that he loves Jacob but hates Esau?

Doesn't John 3:16 say he loves the whole world?

Malachi 1:2b–3a says "'Was not Esau Jacob's brother?' the LORD says. 'Yet I have loved Jacob, but Esau I have hated'" (NIV). If you look only at this portion of the passage, it seems confusing for the God of John 3:16 to hate an individual.

Fortunately, there is more. The context of this passage tells us that neither Esau nor Jacob refer to individuals, but rather to the nations that they produced in their offspring. Esau represents Edom, and Jacob represents Israel.

In Malachi 1:4, God states, "They will be called the Wicked Land, a people always under the wrath of the LORD" (NIV). The Edomites as a nation were not showing God the honor due him. They were wicked, and God shows his displeasure with them in his wrath.

It is not unlike God to punish a nation for disobedience and wickedness. This is why God destroyed Sodom. It is also why he planned to level Ninevah. Unlike the Edomites, the Ninevites repented of their wickedness and were spared. God's love was extended to them by giving them opportunity to repent and find forgiveness.