Zmaj was born in Novi Sad. He finished elementary school in Novi Sad, and secondary school in Bratislava, later studying in Budapest, Prague and Vienna. In 1870, he returned to Novi Sad to work as a doctor, motivated by the fact that his wife and children were suffering from and eventually died from tuberculosis.
He wrote in many of the genres of poetry, including love, lyric, patriotic, political, youth's, and educational poetry. But he is best known for his children's poetry. His nursery rhymes have entered the Serbian national consciousness and people sing them to their children even without knowing who wrote them.
His nickname Zmaj (Змај, meaning "dragon") derives from May Assembly date, 3 May 1848, in Serbian Cyrillic: 3.мај / Змај.