1.0.38 • Published 4 years ago

csv-into-json v1.0.38

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

#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 -

Express-Code

##Installation

$ npm install csv-into-json

##Usage

  • Parse your CSV-file data into JSON in two steps:
    1. Provide relative path to your CSV file inside: csvPath(" ./yourfilepath ") and store it inside a variable.
    2. 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

4 years ago

1.0.37

4 years ago

1.0.36

4 years ago

1.0.35

4 years ago

1.0.34

4 years ago

1.0.33

4 years ago

1.0.32

4 years ago

1.0.31

4 years ago

1.0.30

4 years ago

1.0.29

4 years ago

1.0.28

4 years ago

1.0.27

4 years ago

1.0.26

4 years ago

1.0.25

4 years ago

1.0.24

4 years ago

1.0.23

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.12

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago