1.0.38 • Published 5 years ago

csv-into-json v1.0.38

Weekly downloads
1
License
MIT
Repository
-
Last release
5 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

5 years ago

1.0.37

5 years ago

1.0.36

5 years ago

1.0.35

5 years ago

1.0.34

5 years ago

1.0.33

5 years ago

1.0.32

5 years ago

1.0.31

5 years ago

1.0.30

5 years ago

1.0.29

5 years ago

1.0.28

5 years ago

1.0.27

5 years ago

1.0.26

5 years ago

1.0.25

5 years ago

1.0.24

5 years ago

1.0.23

5 years ago

1.0.22

5 years ago

1.0.21

5 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.12

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago