title: Reactjs converting a csv file in local to json
body: <p>I am trying to convert a .csv file into a JSON object in Reactjs. For this, I add the file I need to convert into the project structure under a folder called Data. I then found this npm package <a href="https://www.npmjs.com/package/convert-csv-to-json" rel="nofollow noreferrer">https://www.npmjs.com/package/convert-csv-to-json</a> and tried the following piece of code to convert file</p>
  
  <pre><code>import { getJsonFromCsv } from "convert-csv-to-json";
  ...
  let json = getJsonFromCsv('./Data/finaldata.csv');
  for (let i = 0; i &lt; json.length; i++) {
  console.log(json[i]);
  }
  </code></pre>
  
  <p>But trying this is throwing an </p>
  
  <blockquote>
    <p>"TypeError: fs.readFileSync is not a function" </p>
  </blockquote>
  
  <p>So I would like to know if something is wrong with my code or Can someone suggest another method to convert CSV file to JSON</p>