Questions tagged [csvtojson]

101 questions
0
votes
0 answers

Convert a string to JSON Object in Javascript

Hi I am getting a string like below when parsing a CSV file using csvtojson npm module . "{"baselineWifiStrength":"10Mbps","userWifiStrength":"3Mbps"}" Code to read from csv const csvData = req.files.csvfile.data.toString('utf8'); …
naveen
  • 107
  • 1
  • 1
  • 10
0
votes
0 answers

convert CSV file to json with comma decimal delimiter jackson

I have the following csv file id;productCode;cost 123132;10204;524,07 123132;10205;222,02 I am looking for suggestions on how to handle a csv file that have a comma in value (eg cost). I am using following code: Class…
Jimmysnn
  • 583
  • 4
  • 8
  • 30
0
votes
1 answer

converting multiple csv files to json synchronously in nodejs

exports.upload = async (req, res) => { if (!req.files) { ResponseHandler.notFound(res, ERROR.ALL_FIELD_REQUIRED); } const files = req.files; for(let file of files){ const csvFilePath = file.path; fs.readFile(csvFilePath,…
Manav Kothari
  • 1,149
  • 1
  • 6
  • 7
0
votes
1 answer

Csvtojson module returning unwanted keys

First question here, Im trying to get a JSON object from a csv file using csvtojson npm module. Everything works except the JSON object that i get has object keys on it: Expected result: { {"key": "value", "other_key": "other_value" }, …
0
votes
0 answers

CSV to nested Json convert in java

I need to convert CSV file into nested json format as like below. netgroup = "literals": [ { "type": "Network", "value": "10.0.0.0/8" }, { "type": "Host", "value": "10.0.0.27" }, { "type": "Host", …
Kannan
  • 1
  • 1
0
votes
2 answers

CSV to Json library not working in node js

I am trying to parse a csv file from the FTP server. The problem arises when the file has only one line of data. It works fine if the file has more than 1 line of data. The following code does the job. After debugging I figured out that fromString…
Hassan Abbas
  • 1,166
  • 20
  • 47
0
votes
3 answers

How to avoid the error which throws a csvtojson

I try to use csvtojson const csv = require("csvtojson"); const csvFilePath = require('./../../books.csv'); csv() .fromFile(csvFilePath) .then((jsonObj)=>{ console.log(jsonObj); }) My file.csv is Book,Author,Amount,Price The Compound…
Slava
  • 161
  • 1
  • 5
0
votes
2 answers

How to convert csv to JSON when a row has two values for one column in node js

I have a csv file in which a row sometimes has two values for a column. Currently I m trying to split using , but is not working as expected. Can someone throw light on how to achieve the expected output. I do not want to use any npm…
saketh
  • 803
  • 1
  • 10
  • 24
0
votes
3 answers

Convert Large CSV into multiple JSON arrays of fixed records (eg. 100 records json arrays ) using Shell

How do i convert a large CSV into JSON Arrays of fixed record set ( JSON arrays of 100 records ) through SHELL script or command line? Eg. of Input CSV…
Mayur Kadam
  • 145
  • 1
  • 12
0
votes
1 answer

create each csv row to json file in php

i found this code for csv row as a object $fp = fopen('test.csv','r') or die("**! can't open file\n\n"); $i = 0; while($csv_line = fgetcsv($fp,1024)) { $i++; $json['json_'.$i]['id'] = $csv_line[0]; $json['json_'.$i]['product_id'] =…
Prashant
  • 143
  • 1
  • 1
  • 7
0
votes
1 answer

stream - 'done event is being called even when pausing the connection'

I am trying to read from csv and i am pausing the stream as i need to do do some async task using await. However the done event is called before the all the row has been processed. as I understand even when paused that doesn't stop the done even…
Abhishek Anand
  • 447
  • 5
  • 22
1 2 3 4 5 6
7