title: How to convert string to json in nodejs?
body: <p>Here the code to list the data's in a csv file which is stored in S3 using nodejs code  but I want the output as expected output which is posted in below. Can someone help me to achieve that</p>
  <p>CODE:</p>
  <pre><code>const AWS = require('aws-sdk');
   const fs = require('fs');
   const express = require('express')
  const neatCsv = require('neat-csv');
  
  const app = express()
  
  var s3 = new AWS.S3({
      accessKeyId:'-----',
      secretAccessKey:'-------',
      region:'ap-south-1'
  });
  
  app.get('/s3',(req,res)=&gt;{
  const params = {
   Bucket:'xxxxx',
   Key:'sample_2.csv'
            };
  
            s3.getObject(params,async(err, result) =&gt; {
              if (err){
                  return console.error(err);
              }
              res.send(result.Body.toString('utf-8'))
            });
          })
  
  
  app.listen(3000,()=&gt;{
      console.log('listenning')
  })
  </code></pre>
  <p>OUTPUT:</p>
  <pre><code>Id,Name,Age,Gender 1,sethu,24,male 2,vimal,23,male 3,thiyanesh,22,male
  </code></pre>
  <p>EXPECTED OUTPUT:</p>
  <pre><code>[
  {
  &quot;Id&quot;: &quot;1&quot;,
  &quot;Name&quot;: &quot;sethu&quot;,
  &quot;Age&quot;: &quot;24&quot;,
  &quot;Gender&quot;: &quot;male&quot;
  },
  {
  &quot;Id&quot;: &quot;2&quot;,
  &quot;Name&quot;: &quot;vimal&quot;,
  &quot;Age&quot;: &quot;23&quot;,
  &quot;Gender&quot;: &quot;male&quot;
  },
  {
  &quot;Id&quot;: &quot;3&quot;,
  &quot;Name&quot;: &quot;thiyanesh&quot;,
  &quot;Age&quot;: &quot;22&quot;,
  &quot;Gender&quot;: &quot;male&quot;
  }
  ]
  </code></pre>