title: How to parse a JSON array in javascript that has a single quote around each object in the array?
body: <p>I have a weird situation here. I have a text file that is a list of JSON objects and they are separated by line breaks like this:</p>
  
  <pre><code>{"upSpeed": 13.860419184316857, "downSpeed": 85.93058668830014, "time": "2016-12-12T21:31:56.507318"}
  {"upSpeed": 13.860419184316857, "downSpeed": 85.93058668830014, "time": "2016-12-12T21:31:56.507318"}
  {"upSpeed": 13.890492898595365, "downSpeed": 87.35392034236816, "time": "2016-12-12T21:37:52.174878"}
  {"upSpeed": 13.69741910903317, "downSpeed": 88.08812682966898, "time": "2016-12-12T21:41:04.688231"}
  ...
  </code></pre>
  
  <p>I use <code>fs.readFile(text file)</code> to load that text file and then <code>array = data.split("\n")</code> to split the text file by line and then insert each line into <code>array</code>, creating a JSON array named <code>array</code>. But, the issue is when I split the original text file using <code>data.split("\n")</code>, the program wraps the resulting object in single quotes (<code>'</code>) on either side, resulting in invalid JSON. So, it ends up looking like this:</p>
  
  <pre><code>[ '{"upSpeed": 13.860419184316857, "downSpeed": 85.93058668830014, "time": "2016-12-12T21:31:56.507318"}',
    '{"upSpeed": 13.860419184316857, "downSpeed": 85.93058668830014, "time": "2016-12-12T21:31:56.507318"}',
    '{"upSpeed": 13.890492898595365, "downSpeed": 87.35392034236816, "time": "2016-12-12T21:37:52.174878"}',
    '{"upSpeed": 13.69741910903317, "downSpeed": 88.08812682966898, "time": "2016-12-12T21:41:04.688231"}'
  ...]
  </code></pre>
  
  <p>So, is there anyway to avoid the single quotes from being added in so the result is an actual javascript object? I have attempted to create a <code>for</code> loop and loop through each element in the array and run <code>array[i] = array[i].replace(/'/g, "");</code> to replace the single quotes with nothing (<code>""</code>) but that simply does not work and returns the same exact result shown above. Any ideas?</p>