Json通过Jil抛出异常反序列化

时间:2016-12-22 15:14:32

标签: json jil

我有这段代码:

//JSON is in Jil library
var a = JSON.Deserialize(@"{""PhoneNumber"": ""09214523155"",""Password"": ""1928160"",""Token"": ""string"",""SubSystem"": ""string"",""Version"": 0,""DeviceType"": 0} ", typeof(LoginContactInput), Options.ISO8601);

这是我的LoginContactInput课程和DeviceType枚举:

public class LoginContactInput 
{
    public string PhoneNumber { get; set; }
    public string Password { get; set; }
    public string Token { get; set; }
    public string SubSystem { get; set; }
    public int Version { get; set; }
    public DeviceType DeviceType { get; set; } //DeviceType is an Enum
}
 public enum DeviceType
{
    Mobile,
    Server
}

但这引发了一个例外:Expected character: '"'

我认为我的json是正确的

出了什么问题?

0 个答案:

没有答案