title: CSV string to array when there is \n in body
body: <p>I'm trying to convert a CSV string into an array of array of objects. Although the issue is, there is a bunch of <code>\n</code> in the body from the incoming request, with are causing the request to split and mess up all the code. I'm attempting to fix this even with <code>\n</code> in the body<br>
  The string looks like this, all the messages that are strings from the incoming request, starts with a <code>\&quot;</code> and finishes with <code>\&quot;</code>.</p>
  <pre><code>&quot;id,urn,title,body,risk,s.0.id,s.1.id,s.2.id,a.0.id,a.1.id,a.2.id,a.3.id
  302,25,\&quot;Secure Data\&quot;,\&quot;Banking can save a lot of time but it’s not without risks. Scammers treat your bank account as a golden target –
  it can be a quick and untraceable way to get money from you\n\n**TOP TIPS**\n\n**Always read your banks rules.** These tips don’t replace your banks rules - \
  in fact we fully support them. If you don’t follow their rules, you may not get your money back if you are defrauded \n\n**Saving passwords or allowing auto-complete.** 
  Saving passwords in your browser is great for remembering them but if a hacker is able to access your computer, they will also have access to your passwords. 
  When on your banking site the password box we recommend you don’t enable the auto-complete function – a hacked device means they are able to gain access using this method \n\n**Use a 
  PIN number on your device.** It’s really important to lock your device when you’re not using it.\&quot;,,2,20,52,1,2,3,4&quot;
  </code></pre>
  <p>I have attempted to make it smaller since there is a bunch of content, but the string that comes is basically the above, The big string with is messing my code up start at <code>Banking can save</code> and finishes at <code>not using it.</code> I have several other datas that have the same type of body, and always comes inside <code>\&quot; body \&quot;</code>, I have been attempting to perform a function to separate the content from this CSV string, into an array of array or an array of objects.
  <br>This is what I attempted:</p>
  <pre><code>function csv_To_Array(str, delimiter = &quot;,&quot;) {
        const header_cols = str.slice(0, str.indexOf(&quot;\n&quot;)).split(delimiter);
        const row_data = str.slice(str.indexOf(&quot;\n&quot;) + 1).split(&quot;\n&quot;);
        const arr = row_data.map(function (row) {
          const values = row.split(delimiter);
          const el = header_cols.reduce(function (object, header, index) {
            object[header] = values[index];
            return object;
          }, {});
          return el;
        });
  
        // return the array
        return arr;
      }
  </code></pre>
  <p>I have thought on using regex too, where I would split if it had a comma of a \n, although if there is a /&quot; it will split when it finds the next /&quot;:</p>
  <pre><code>array.split(/,/\n(?!\d)/))
  </code></pre>