
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How can we retain Carriage return and line feed (\r\n) while writing the data in tFileOutputDelimeter
Hi All,
I am converting a JSON to CSV, and noticed that there is a column "Title" in JSON with value as "Welcome to the JSON,\r\nNew World".
Now, I want to write the text in the same way in the CSV file but unfortunately the \r\n is getting treated as line feed and the output is showing as
"Welcome to the JSON,
New World".
Expected outcome:
"Welcome to the JSON,\r\nNew World".
I have tried with all the options in CSV Row separator (LF, CR, CRLF) then
changed
the Advance settings to """ and "\"" did not work.Any help??
Regards
SD3156

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are getting the correct outcome. "\r\n" is how Java Strings handle carriage returns and line feeds. When they are output to a file (or any other output location), they are carriage returns and line feeds and you will see them shown like that. If you want to see \r\n then you will have to replace the carriage return and line feed with \r\n.
The other option you have is to encase your Strings in quotes for CSV. You can do that like this.....
However, it will still spill over two lines.
To return \r\n as text (which will permanently be a \r\n instead of a carriage return and line feed after this event, you can use a tMap and use the following code to carry out the replacement....
row1.yourColumn.replace("\r\n", "\\r\\n")
