objects-to-csv icon indicating copy to clipboard operation
objects-to-csv copied to clipboard

Automatically convert boolean to INT in the CSV

Open erajanraja24 opened this issue 3 years ago • 2 comments

When I try to create a CSV with below data, CSV file was created with value 1 for true and empty for false but I expect to be updated as true or false

[
  {
    email_address: '[email protected]',
    domain: 'gmail.com',
    valid_syntax: true,
    disposable: false,
    webmail: true,
    deliverable: true,
    catch_all: false,
    gibberish: false,
    spam: false
  },
  {
    email_address: '[email protected]',
    domain: 'gmail.com',
    valid_syntax: true,
    disposable: false,
    webmail: true,
    deliverable: true,
    catch_all: false,
    gibberish: false,
    spam: false
  },
  {
    email_address: '[email protected]',
    domain: 'gmail.com',
    valid_syntax: true,
    disposable: false,
    webmail: true,
    deliverable: true,
    catch_all: false,
    gibberish: false,
    spam: false
  }
]
Screenshot 2022-01-26 at 2 15 46 PM

erajanraja24 avatar Jan 26 '22 04:01 erajanraja24

I have a similar issue, have you figured out any solutions?

Update:

Seems to happen from stringify in https://github.com/adaltas/node-csv I had to iterate over every object and manually change true/false to 1 and 0

na21 avatar Feb 23 '22 22:02 na21

'true'

benfavre avatar Jan 27 '23 13:01 benfavre