1

我有这段代码:

//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 是正确的

怎么了?

4

0 回答 0