Jesus seemed to take it literally.
It was a teaching narrative about how God loved all his children even the people of Nineveh. It's comic fiction.
Haven't you read Aesop's Fables? They were written by a Greek slave around the same time.
Memorable stories are an excellent teaching device.
The Book of Genesis is the first book of the Bible and is part of the Torah, or Pentateuch, which is the first five books of the Bible.
The book is thought to have been composed around the 5th century BC, but some scholars believe that chapters 1–11, which cover primeval history, may have been added as late as the 3rd century BC.
The authors of Genesis borrowed themes from Mesopotamian mythology and ancient near eastern cosmology, but adapted them to their unique belief in one God. The creation myth in Genesis 1 may have been created by a Hebrew scribe living in Babylon during the Babylonian Exile in the 4th century BCE.
Genesis is divided into two parts:
Primeval history
Chapters 1–11 include stories such as the creation, the Garden of Eden, Cain and Abel, Noah and the Flood, and the Tower of Babel.
Patriarchal history
Chapters 12–50 include stories such as Abraham, Isaac and his twin sons Jacob and Esau, and Jacob's family, including Joseph.
Most mainstream Bible scholars consider Genesis to be primarily mythological rather than historical.