Reputation: 53
This happends JsonSerializer but not with TypeSerializer.
Default char serialization is "\u0000" but deserialization of that string into char is '\'.
Is this a bug? or I am missing something?
Any workaraound? maybe some JsConfig.SerializeFn and JsConfig.DeSerializeFn?
I have done a simple program to test it:
public class MyObj
{
public char AChar { get; set; }
}
public static void Main(string[] args)
{
var obj = new MyObj();
var json = obj.ToJson();
System.Console.WriteLine(json);
var newObj = json.FromJson<MyObj>();
if (newObj.AChar == obj.AChar)
System.Console.WriteLine("Ok!");
else
System.Console.WriteLine(newObj.ToJson());
}
Thanks!
Upvotes: 1
Views: 43
Reputation: 143319
This issue should now be resolved from this commit.
This change is available from v5.4.1 that's now available on MyGet.
Upvotes: 1