jsoncsv icon indicating copy to clipboard operation
jsoncsv copied to clipboard

has no method 'join'

Open indiesquidge opened this issue 11 years ago • 2 comments

So I'm trying to get a very basic example running using your example on the module listing and your data.json from the repo. My script looks as follows:

default.js

var jsoncsv, data, fs;
fs = require('fs');
jsoncsv = require('jsoncsv');

data = fs.readFileSync('data.json').toString();

jsoncsv.parse(data, function(err, row) {
  return console.log(row);
});

it keeps returning the error

TypeError: Object function (err, row) {
  return console.log(row);
} has no method 'join'

Am I doing something wrong? It's just your example code, so I'm not sure what could be happening. I realize the module is quite outdated, but any advice would be helpful. Thanks.

indiesquidge avatar Oct 30 '14 06:10 indiesquidge

I figured out that you need to specify column headers when calling this, so I did eventually get it to print out something. Now, however, the problem seems to be that when I give it my .json file, it spits out a .csv that has literally every character separated by commas. Not sure what to do there.

indiesquidge avatar Oct 30 '14 06:10 indiesquidge

@indiesquidge try my modification here: https://github.com/gradus/jsoncsv/pull/4 I had the same issue, there seem to be some bugs in @gradus's code. Hopefully my pull req fixes them.

alexbfree avatar Mar 17 '15 14:03 alexbfree