RestSharp Json 在内容中但不在数据中

RestSharp Json in Content but not in Data

我有一个 Class Meeting:

public int idMeeting { get; set; }
public DateTime dateTime { get; set; } // DateTime(Int32, Int32, Int32, Int32, Int32, Int32)  Jahr, Monat, Tag, Stunde, Minute und Sekunde.
public int idRoom { get; set; }
public int idPerson { get; set; }
public List<Person> participants { get; set; }

Person

public int idPerson { get; set; }
public string firstname { get; set; }
public string lastname { get; set; }
public string phonenumber { get; set; }
public string mailadress { get; set; }
public int idCompany { get; set; }

使用 RestSharp 请求我从网络服务中得到这个:

[{
  "idMeeting":1,
  "dateTime":"2017-06-21T19:00:00.531",
  "idRoom":1,
  "idPerson":1,
  "participants":[{
     "idPerson":1,
     "firstname":"name",
     "lastname":"name",
     "phonenumber":"0123456789",
     "mailadress":"lars.name@name.de",
     "idCompany":1
   },{
     "idPerson":3,
     "firstname":"Marvin",
     "lastname":"name",
     "phonenumber":"012345678910",
     "mailadress":"Marvin.name@name.de",
     "idCompany":1
  }]
},{
  "idMeeting":2,
  "dateTime":"2017-07-15T17:00:00.531",
  "idRoom":1,
  "idPerson":3,
  "participants":[{
    "idPerson":4,
    "firstname":"Frederic",
    "lastname":"name",
    "phonenumber":"012345678910",
    "mailadress":"Frederik.name@name.de",
    "idCompany":1
  },{
    "idPerson":1,
    "firstname":"Lars",
    "lastname":"name",
    "phonenumber":"0123456789",
    "mailadress":"lars.name@name.de",
    "idCompany":1
  }]
}]

我使用的请求是:

var client = new RestClient("http://myserver");
var request = new RestRequest("project/api/meeting/5", Method.GET);
var response2 = client.Execute<List<Modells.Meeting>>(request);

response2 在内容中有 json,但数据为空。

我在这里没有看到什么错误?

编辑:整个 PersonMeeting Class

public class Person
    {
        public int idPerson { get; set; }
        public string firstname { get; set; }
        public string lastname { get; set; }
        public string phonenumber { get; set; }
        public string mailadress { get; set; }
        public int idCompany { get; set; }
     }




 public class Meeting
    {

        public int idMeeting { get; set; }
        public DateTime dateTime { get; set; } // DateTime(Int32, Int32, Int32, Int32, Int32, Int32)  Jahr, Monat, Tag, Stunde, Minute und Sekunde.
        public int idRoom { get; set; }
        public int idPerson { get; set; }
        public List<Person> participants { get; set; }
}

感谢mjwills

添加行:

request.OnBeforeDeserialization = resp => { resp.ContentType = "application/json"; };

解决了问题。看来我收到的 json 不正确。