1.0.38 • Published 6 years ago
csv-into-json v1.0.38
#csv-into-json
A Synchronous CSV to JSON convertor package.
const {csvPath} = require('csv-into-json')
let data = csvPath('./filename.csv') // providing your file path
let jsonData = JSON.stringify(data) // stringify returned data into JSON
console.log(jsonData)Or use it with express to send JSON response (Content-Type : application/json) as follows -

##Installation
$ npm install csv-into-json##Usage
- Parse your CSV-file data into JSON in two steps:
- Provide relative path to your CSV file inside: csvPath(" ./yourfilepath ") and store it inside a variable.
- Convert the data stored inside that variable into JSON using JSON.stringify() function.
e.g :
- CSV data :
Name,Age,Address in
Andy,21,Down town
Barbara,25,"Old street, 36"
Carl,24,Kings cross - Output JSON :
[
{
"name": "Andy",
"age": "21",
"address-in": "Down town"
},
{
"name": "Barbara",
"age": "25",
"address-in": "Old street, 36"
},
{
"name": "Carl",
"age": "24",
"address-in": "Kings cross"
}
]1.0.38
6 years ago
1.0.37
6 years ago
1.0.36
6 years ago
1.0.35
6 years ago
1.0.34
6 years ago
1.0.33
6 years ago
1.0.32
6 years ago
1.0.31
6 years ago
1.0.30
6 years ago
1.0.29
6 years ago
1.0.28
6 years ago
1.0.27
6 years ago
1.0.26
6 years ago
1.0.25
6 years ago
1.0.24
6 years ago
1.0.23
6 years ago
1.0.22
6 years ago
1.0.21
6 years ago
1.0.20
6 years ago
1.0.19
6 years ago
1.0.18
6 years ago
1.0.17
6 years ago
1.0.16
6 years ago
1.0.15
6 years ago
1.0.14
6 years ago
1.0.13
6 years ago
1.0.11
6 years ago
1.0.10
6 years ago
1.0.9
6 years ago
1.0.12
6 years ago
1.0.8
6 years ago
1.0.7
6 years ago
1.0.6
6 years ago
1.0.5
6 years ago
1.0.4
6 years ago