我正在尝试反序列化我的休息服务收到的JSON,但其中一个参数为null,如下图所示:
以下是我的服务正在接收的JSON:
以下是服务输入的类声明:
[DataContract]
public class OperationInput
{
[DataMember]
public string Status { get; set; }
[DataMember]
public ErrorData[] ErrorList { get; set; }
[DataMember]
public string ACTPRDX { get; set; }
[DataMember]
public PriceData PriceInfo { get; set; }
[DataMember]
public string RequestID { get; set; }
public class ErrorData
{
[DataMember]
public string Code { get; set; }
[DataMember]
public string Message { get; set; }
}
public class PriceData
{
[DataMember]
public string Value { get; set; }
[DataMember]
public string PriceDetail { get; set; }
}
}
[DataContract]
public class OperationOutput
{
[DataMember]
public int Status { get; set; }
[DataMember]
public string Message { get; set; }
}
[ServiceContract]
interface IRegisterOperation
{
[OperationContract]
[WebInvoke(UriTemplate = "/registeroperation",
RequestFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Bare,
ResponseFormat = WebMessageFormat.Json, Method = "*")]
OperationOutput Operation(OperationInput input);
}
对于ErrorList参数它似乎工作虽然它不同,因为它是一个对象数组而PriceData只是一个对象,我不明白为什么它显示为null并且无法解析信息我提供了......