根據此討論中的代碼(How to build object hierarchy for serialization with json.net?),我將如何初始化JNotification並將值分配給包含JPayload,JCustomData,JFilter的JNotification?C#初始化類並分配值Newtonsoft.Json
public class JNotification
{
public string status { get; set; }
public JPayload payload = new JPayload();
public JFilter filter = new JFilter();
}
public class JPayload
{
public string title { get; set; }
public string message { get; set; }
public JCustomData customData = new JCustomData();
}
public class JCustomData
{
public string addType { get; set; }
public string addTitle { get; set; }
public string addMessage { get; set; }
public int addAppraiserId { get; set; }
public int addAppraisalId { get; set; }
public int addAppraisalCommentId { get; set; }
public int addAppraisalStatusHistoryId { get; set; }
}
public class JFilter
{
public int AppraiserId { get; set; }
}
特勒爾斯,正是我一直在尋找。謝謝! – Jeffry