Closed lillem4n closed 7 years ago
Same issue.
@vroudge can you provide sample JSON data that is affected?
{"Subject":"Artis ZOOmeravonden","Start Date":"07/02/2016","Start Time":"03:00 PM","End Date":"07/02/2016","End Time":"10:00 PM","All Day Event":false,"Description":"Artis in the evening\nLetting Amsterdam’s party animals in, ZOOmeravonden welcomes guests to explore the Artis Royal Zoo during the summer evenings until sunset. Some of the animals will be shaking off the last bit of energy before bed, while others will still be wide-eyed and of course those nocturnal animals are just waking up. So come get up close and personal with the furry and feathered kind. Zookeepers and animal carers are on hand throughout the zoo to share the secrets of the creatures.\nLive music and activities\nIf the choir of lion roars and bird chirps aren’t enough, adding to the entertainment are well-known Dutch musicians and students from Amsterdam’s music academy taking to the bandstand to serenade the audience. Guests can also take part in workshops, guided tours and activities for children. Dinner is served with picnics and barbecued delicacies available to eat on the lawn.\nStay in the know\nThe name ZOOmeravonden is a play on words with Zoo and Zomer, the Dutch for summer, while ‘avonden’ means evenings. The Artis Royal Zoo is just east of the city’s centre. For more information visit the Artis Royal Zoo website. Website: http://www.artis.nl","Location":"Natura Artis Magistra, Plantage Kerklaan 38-40, 1018 CZ AMSTERDAM"}
@kayheunen what options are you running against that JSON?
None, atm. I've tried newLine: "\n", newLine: "\n", newLine: '\n', newLine: '\n' and some others.
All of the above are the same.
Ah sorry, github didn't accept. take the double backslash and the double and single quotes.
newLine: "\n"
newLine: "\\n"
newLine: '\n'
newLine: '\\n'
What do you propose to use, given the input in my first comment?
single quotes and double quotes don't make a difference. Will look more into this.
So what should I put as options? Given that I'm looking for \n
as newline separator
@knownasilya is it an escaping issue?
I think the issue is JSON.stringify escapes \n
. PR submitted
Released as v3.4.2
This was reverted in https://github.com/zemirco/json2csv/commit/eb0bb6edae298f635dd3e4c1c5afe974b1dc13b2
Is there currently some way to work around this issue? Could this be reopen?
Any news?
We probably need an excel flag..
This feature is working for me. At least on Mac (I haven't tested on PC), I need to use a \r rather than \n for Excel to recognize it as a newline within a cell.
What is the plan in terms of when this will be released via npm? I see that this issue is tagged as "needs tests" - I can try to take a crack at that if someone points me in the right direction.
@mkopinsky did https://github.com/zemirco/json2csv/pull/171 work for you? If so, I can cut a release today.
Yes. I am working through https://github.com/punkave/albedo, and a SQL query like SELECT 'a\rb' UNION SELECT 'c\rd'
is generating a CSV file which opens in Excel with the two data cells with line breaks in them.
Hey @knownasilya can you cut that release? Or, is there any other testing I can do that would help?
v3.8.0 has been released
Awesome, thanks!!
Instead of a newline in a field, I just get the string \n .
When I manually create the CSV string myself, it works great.