https://github.com/imrandil/csv_to_json_npm_package
A simple npm package to generate json file from CSV file.
https://github.com/imrandil/csv_to_json_npm_package
csv-files javascript json npm-package
Last synced: 4 months ago
JSON representation
A simple npm package to generate json file from CSV file.
- Host: GitHub
- URL: https://github.com/imrandil/csv_to_json_npm_package
- Owner: IMRANDIL
- Created: 2024-05-07T15:41:52.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-18T01:17:56.000Z (about 2 years ago)
- Last Synced: 2025-10-21T02:51:08.513Z (8 months ago)
- Topics: csv-files, javascript, json, npm-package
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/@imrandil/csv_to_json
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
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:
```bash
npm install @imrandil/csv_to_json
```
## Usage
```javascript
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](LICENSE) file for details.