Published on

How to convert CSV to JSON in Node.js

Authors

Most of the time, file imports usually consists of CSV files.

And we need to process them in our application. However, converting them to JSON object gives us more flexibility than CSV string.

Let's see how to do that in Node.js

Install the Dependencies

npm install neat-csv

Snippet

import neatCsv from "neat-csv";
const rawJson = await neatCsv(`CSV file's content as string here`);

console.log({rawJson});

Happy playing-with CSV!