Converta CSV em JSON Typescript

Better use an exing library, many use cases already managed:
https://www.npmjs.com/package/convert-csv-to-json

You can still have a vanillia solution here:
https://www.geeksforgeeks.org/how-to-convert-csv-to-json-file-having-comma-separated-values-in-node-js/
Norman