Questions tagged [csvtojson]

101 questions
1
vote
1 answer

How to extract only certain fields from CSVTOJSON in nodejs?

I have managed to convert CSV data to JSON using the csvtojson npm package and successfully display it in the console. csvtojson() .fromFile(csvFilePath) .then(jsonObj => { console.log(jsonObj); }) [ { id: '1', …
Nat
  • 679
  • 1
  • 9
  • 24
1
vote
1 answer

CSV to JSON list of arrays

My csv is like this, only have numbers. No headers. I have to identify the name of each column in the javascprit (node.js)…
youngt17
  • 55
  • 7
1
vote
0 answers

Import CSV file data into MongoDB using mongoose

I am building a full-stack application using MERN(MongoDB, Express, React, Node.js). I have a .CSV file that I uploaded to MongoDB. However I can't get my routes to return any data. I can see the database collection on my MongoDB cluster, But it's…
codernon
  • 35
  • 1
  • 7
1
vote
1 answer

How to convert object keys to arrays with jq

I am trying to convert a csv where the headers are keys and the values in the column are a list. For example I have the following csv mpg cyl disp hp drat wt qsec vs am gear carb Mazda RX4 21 6 160 110 …
Alex
  • 2,603
  • 4
  • 40
  • 73
1
vote
0 answers

How to convert http.get response in CSV to JSON NodeJS

http.get request returns csv.gz file. After unzipping I would like to convert it to JSON and upload to mongoDB How to implement convertation function on stream? My code is following: const download = (url, dest) => { const request =…
Igor
  • 21
  • 4
1
vote
2 answers

npm package csvtojson CSV Parse Error: Error: unclosed_quote

Node version: v10.19.0 Npm version: 6.13.4 Npm package csvtojson Package Link csvtojson({ "delimiter": ";", "fork": true }) .fromStream(fileReadStream) .subscribe((dataObj) => { console.log(dataObj); }, (err) => { console.error(err); },…
Mayur Bhatt
  • 65
  • 2
  • 7
1
vote
1 answer

AWS Lambda- Cannot find module 'csvtojson'

I am using AWS Lambda service to read the content from the CSV file uploaded on the S3 bucket and convert it to the JSON format. I got stuckup on the CSV to JSON phase. const AWS = require('aws-sdk'); const csvtojson = require('csvtojson'); …
Nandy
  • 666
  • 1
  • 12
  • 27
1
vote
1 answer

Convert csv to JSON with comments at the top of document (Node.js)

I'm using csvtojson library in NodeJS to convert csv file to JSON. var csv = require("csvtojson"); async function convert() { const jsonArray=await csv({delimiter:[";"]}).fromFile("file.csv"); console.log(jsonArray); } The problem is that…
Marin Leontenko
  • 711
  • 2
  • 20
  • 26
1
vote
1 answer

Converting csv to json using python multiprocessing

I have around 30 csv files which I am trying to convert to json in parallel. The conversion is happening , but is taking quite sometime. Around 25 minutes. Each file will have 2 million records. Below is my code. I am new to python, can you suggest…
Aritra Bhattacharya
  • 720
  • 1
  • 7
  • 18
1
vote
1 answer

How do I convert a csv to json with npm's csvtojson and ignore the first row in the csv?

I have a csv as such: this is the first column, this is the 2nd, firstVal, secondVal david, baseball jon, soccer I want to convert this to: [{firstVal:david,…
yalpsid eman
  • 3,064
  • 6
  • 45
  • 71
1
vote
0 answers

Trailing comma error on last json array entry using node-csvtojson - Invalid JSON

I am currently trying to stream a very large CSV file (130k rows) to be converted to a JSON file. Which I can then iterate over later on. The problem is csvtojson is adding a comma to the very last entry, making it invalid JSON to deal with. var…
CyrisXD
  • 147
  • 9
1
vote
0 answers

csvtojson npm is rounding 7945160000000000 to 7.95E+15

i am getting rounded values as string from csv, i don't want values to get rounded of i need the exact value from the csv is there any way? (async() => { try { let csvInUsers = [] const jsonArray = await csv({ trim: true …
0
votes
1 answer

converting csv to json not working as expected?

I am following this article to convert csv to json. But I am not getting required output. step 1 - $ echo -e "foo,bar,quux\n1,2,3\n4,5,6\n7,8,9" > foo.csv Test Step 2 - $ jq -R 'split(",")' foo.csv | jq -cs The output is as expected as below…
CodeBot
  • 33
  • 5
0
votes
0 answers

how to remove csv header while converting to json

I am using node js lib "csvtojson" to read csv files and convert to json. in my project folder i have 2 csv files which i am trying to read and convert to json and send the json as a response . Below is the csv content. Both the files having same…
user2542953
  • 127
  • 1
  • 9
0
votes
1 answer

csvtojson printing unknown charcters

I am trying to convert csv to json. This CSV contains emojis, i guess that might be the problem. csvtojson or any other module or even any custom method is returning unknown characters/garbage characters. My csv file link below: CSV The code i am…