A quick post about a great site we sometimes use when needing to convert an SVG image into code, the site is: jakearchibald.github.io/svgomg/
Once uploaded you can play about with the settings of the code output and tailor it to your specific needs.
It is also a great way to reduce the file size of your SVG, even if it is minimal.
If you prefer you can download the tool here: github.com/jakearchibald/svgomg