"'There is a Persian story I read as a girl, about a princess and a beggar, and a djinn."

Illustration from 'The Thousand and One Nights'
Public DomainIllustration from 'The Thousand and One Nights' - Credit: Sani ol-Molk
Perhaps a reference to one of the stories from The Thousand and One Nights (also known as The Arabian Nights), a collection of Arabian folk tales.

Forty two of the folk tales were translated into English by Edward William Lane, and published in 1840 and 1859.

Does anybody know which story this refers to?