Convert into json from csv returned from an api

I have an api that returns data in csv,
I created a workflow to save this file as url as text data type then wrote a js code to fetch this file and read it then return it in json format but that does not happen it return as text and not iterable
There is no plugin can help with this as i restructure my json data so plugins won’t help
Does anyone have any Idea how to do this cause i have struggling for hours
Thanks in advance