The Demon symbolized blind pride and vengefulness. He was going to kill anyone who released him from the jar, despite the fact that it would be easy to assume that the people releasing him were doing him a kind service. He admitted to having originally wanted to reward the people kind enough to free him, but grew bitter at his trapped state and decided to kill whoever freed him.
This is a direct comparison to the King in the base story of 1001 Nights. One woman wronged the king and he proceeded to punish citizen after citizen, just as the demon was punishing anyone who freed him, just because previous possible saviors had not succeeded in freeing him.
The story is an allegory for the king to realize that he is being irrational and blind in his treatment of his citizens. The fisherman tricked the demon just as she tricked the king – with a story and with reason.