For my unix / java friends, I would like to send newlines ('\ n') instead of CRLF ('\ r \ n') to Json.Net. I tried setting StreamWriter to use a new line without any success.
I think the Json.Net code uses Environment.NewLine instead of calling TextWriter.WriteNewLine() . Changing Environment.NewLine not an option, because I work as a server, and the encoding of the new line is based on the request.
Is there any other way to force a newline for crlf?
Here is my code -
using (var streamWriter = new StreamWriter(writeStream, new UTF8Encoding(false)) { NewLine = "\n" }) using (var jsonWriter = new JsonTextWriter(streamWriter) { CloseOutput = true, Indentation = 2, Formatting = Formatting.Indented }) {
Richard Schneider
source share