He was the only son of Stephen of Anjou, Duke of Croatia, Dalmatia and Slavonia, and Margaret of Bavaria.
[1][2] In Hungary, Stephen was regarded the heir to his sonless eldest brother, Louis I of Hungary,[1] but the Polish noblemen forbade Stephen to interfere in Polish affairs when they confirmed, in 1351, Louis's right to inherit Poland from his maternal uncle, Casimir III of Poland.
[3][4] John's mother was the daughter of the Holy Roman Emperor, Louis IV.
[6] He was regarded the heir to Louis I who also persuaded Casimir III of Poland to adopt John in 1355.
[8][2] Not independently of the war with Venice, Louis I appointed a lieutenant to rule Slavonia in the spring of 1356, and a ban to administer Croatia and Dalmatia in 1357.