我有一个问题,我似乎不知道如何序列化类型的对象:
public class SchedulingCalendarMonth
{
public List<SchedulingCalendarWeek> Weeks {get; set; }
}
public class SchedulingCalendarWeek
{
public List<SchedulingCalendarDay> Days { get; set; }
}
public class SchedulingCalendarDay
{
public int Id { get; set; }
public bool SomeBoolProperty { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我尝试过这样的事情:
<script type="text/javascript">
$(document).ready(function () {
var Month =
{
Weeks: []
};
var Weeks = { Days: [{ Id: 1, SomeBoolProperty: true }, { Id: 4, SomeBoolProperty: true }, { Id: 43, SomeBoolProperty: false}] };
Month.Weeks …Run Code Online (Sandbox Code Playgroud)