JSON.Net Self referencing loop detected

前端 未结 11 813
伪装坚强ぢ
伪装坚强ぢ 2020-11-28 04:18

I have a mssql database for my website within 4 tables.

When I use this:

public static string GetAllEventsForJSON()
{
    using (CyberDBDataContext d         


        
11条回答
  •  感情败类
    2020-11-28 05:01

    If using ASP.NET Core MVC, add this to the ConfigureServices method of your startup.cs file:

    services.AddMvc()
        .AddJsonOptions(
            options => options.SerializerSettings.ReferenceLoopHandling =            
            Newtonsoft.Json.ReferenceLoopHandling.Ignore
        );
    

提交回复
热议问题