@imrandil/csv_to_json
v1.0.1
Published
A simple npm package for generating json file (.json) from CSV file.
Downloads
2
Readme
CSV to JSON Converter
A simple npm package for generating a JSON file (.json) from a CSV file.
Installation
You can install the package via npm:
npm install @imrandil/csv_to_json
Usage
const convertCSVtoJSON = require('@imrandil/csv_to_json');
const csvFilePath = 'example.csv';
const jsonFilePath = 'output.json';
(async () => {
try {
await convertCSVtoJSON(csvFilePath, jsonFilePath);
console.log('CSV converted to JSON. JSON file saved:', jsonFilePath);
} catch (error) {
console.error('Error converting CSV to JSON:', error);
}
})();
API
convertCSVtoJSON(csvFilePath, jsonFilePath)
Converts a CSV file to a JSON file.
csvFilePath
(string): The path to the CSV file.jsonFilePath
(string): The path to save the JSON file.
Returns a Promise that resolves when the conversion is complete.
License
This project is licensed under the MIT License - see the LICENSE file for details.