从 SFDC REST Web 服务接收以下响应(下面的字符串jsonResponse):
{
"responseDataList": [{
"salesforceRecordId": "a00C000000L5DQRIA3",
"recordName": "Computer_Name_2",
"IsSuccess": true,
"errorMessage": null
}]
}
尝试使用 ServiceStack.JsonSerializer 对其进行反序列化:
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
string jsonResponse = new StreamReader(response.GetResponseStream()).ReadToEnd();
ResponseDataList list = JsonSerializer.DeserializeFromString<ResponseDataList>(jsonResponse);
ResponseDataList 具有以下结构:
public class ResponseData
{
public string salesforceRecordId { get; set; }
public string recordName { get; set; }
public bool IsSuccess { get; set; }
public string errorMessage { get; set; }
}
public class ResponseDataList
{
List<ResponseData> responseDataList { get; set; }
}
但是在反序列化之后 ResponseDataList 列表为空。我做错了什么,如何正确反序列化?