class
ASP.NET MVC プロジェクトで次の C# を使用しています。
public class ZoneModel {
public int Id { get; set; }
public int Number { get; set; }
public string Name { get; set; }
public bool LineFault { get; set; }
public bool Sprinkler { get; set; }
public int Resistance { get; set; }
public string ZoneVersion { get; set; }
List<DetectorModel> Detectors { get; set; }
}
私Controller
の の1 つにAction
、戻り値の型が の がありJsonResult
、そこからオブジェクトのリストZoneModel
(データベースから取り込まれたもの) を返します。Detectors
プロパティにはデータが含まれていますが、 を使用してコントローラーからリストを返すと、return Json(viewModel);
シリアル化された応答に検出器のリストがありません。
Detectors
プロパティが JSON にシリアル化されないのはなぜですか?