0

I have this CSV data that I converted from JSON after a fetch request using javascript.

datetime","open","high","low","close","volume"
"2020-01-28","312.48999","318.39999","312.19000","317.69000","31027981"
"2020-01-27","309.89999","311.76001","305.89001","308.95001","36450411"
"2020-01-24","320.06320","323.32001","317.53000","318.32999","33995457"
...

I need to remove the " quotes everywhere to further process the data. I tried to use

csvdata.replace("\"", "")

Is there a way to bulk replace or do I need to iterate through each line? I want the data to look like:

datetime,open,high,low,close,volume
2020-01-28,312.48999,318.39999,312.19000,317.69000,31027981
2020-01-27,309.89999,311.76001,305.89001,308.95001,36450411
2020-01-24,320.06320,323.32001,317.53000,318.32999,33995457
...

Thanks for any help!

john mondego
  • 189
  • 1
  • 9

1 Answers1

1

You can use a regular expression with the global flag on it inside replace, so:

let rgx = /"/g;
let removedQuotes = csvdata.replace(rgx, '');
andrewf
  • 375
  • 4
  • 10