This talk will mainly be about applications of complex function theory to inverse spectral problems for canonical systems, which constitute a broad class of second order differential equations. I will start with the basics of Krein-de Branges theory, then present an algorithm for inverse spectral problems developed by Makarov and Poltoratski for locally-finite periodic spectral measures. I will then extend the algorithm to certain classes of non-periodic spectral measures and present several examples. I will also talk about the connection between inverse spectral problems and nonlinear Fourier transform. In particular, how our examples and results for inverse spectral problems can be translated to results for nonlinear Fourier transform. This is joint work with Alexei Poltoratski.