“没有为类型'System.Object []'定义无参数构造函数。”用于RestSharp

时间:2020-08-17 15:48:06

标签: c# asp.net-core asp.net-core-webapi restsharp

我正在尝试反序列化响应对象,但出现此错误

“没有为类型'System.Object []'定义无参数构造函数。”

这是我尝试将Object序列化为请求对象并反序列化为响应对象的地方

request.AddParameter("application/json; charset=utf-8", JsonConvert.SerializeObject(fundTransferRequest), ParameterType.RequestBody);

IRestResponse response = client.Execute(request);
IRestResponse<FundTransferResponse> res = client.Execute<FundTransferResponse>(request);

这是响应对象

public class FundTransferResponse
{
    public string ResponseMessage { get; set; }
    public string ResponseDescription { get; set; }
    public Response Response { get; set; }
}

public class Response
{
    public string TranStatus { get; set; }
    public string TranStatusCode { get; set; }
    public string SopraReference { get; set; }
    public string ReasonCode { get; set; }
    public object[] ReasonDescription { get; set; }
}

0 个答案:

没有答案