JSON.NET Error Self referencing loop detected for type

后端 未结 25 2883
我在风中等你
我在风中等你 2020-11-22 02:16

I tried to serialize POCO class that was automatically generated from Entity Data Model .edmx and when I used

JsonConvert.SerializeObject 

25条回答
  •  情深已故
    2020-11-22 02:36

    Just update services.AddControllers() in Startup.cs file

    services.AddControllers()
      .AddNewtonsoftJson(options =>
          options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
       );
    

提交回复
热议问题