ServiceStack.Text newline char serialized as "\" in JsonSerializer

This seems to be a bug.

A newline “\n” char in a C# string should be serialized to JSON as “\n” also, but SS.Text serializes it as "\ "

Example using SS.Text 4.0.41 and Json.NET 6.0.8.

public class Resource
{
    public string Url { get; set; }
}

var resource = new Resource { Url = "hello,\nline 2" };
var jsonNet = Newtonsoft.Json.JsonConvert.SerializeObject(resource); //{"Url":"hello,\nline 2"}
var ssText = ServiceStack.Text.JsonSerializer.SerializeToString<Resource>(resource); //{"Url":"hello,\ line 2"}

The newlines are handled correctly when deserializing the correctly formed JSON.

Not seeing this behavior with the latest version so I expect that this is a result of a bad refactor early on in a v4.0.41 pre-release so this should be resolved by clearing out your NuGet Cache and delete the /packages folder in order to redownload the latest MyGet packages.