.Net Core 3.0 possible object cycle was detected which is not supported
.Net Core 3.0 possible object cycle was detected which is not supported
回答1
Instead of using NewtonsoftJson I used System.Text.Json.Serialization
For .Net Core 3.1
In Startup.cs
public void ConfigureServices(IServiceCollection services)
{
..........
.......
services.AddControllers().AddJsonOptions(options =>
{
options.JsonSerializerOptions.ReferenceHandler = ReferenceHandler.IgnoreCycles;
options.JsonSerializerOptions.WriteIndented = true;
});
}
For .Net 6
In Program.cs
builder.Services.AddControllers().AddJsonOptions(options =>
{
options.JsonSerializerOptions.ReferenceHandler = ReferenceHandler.IgnoreCycles;
options.JsonSerializerOptions.WriteIndented = true;
});
作者:Chuck Lu GitHub |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
2021-11-09 高等数学 第三章 导数与微分 柳重堪 P10-P19 10个视频
2021-11-09 How to specify data attributes in razor, e.g., data-externalid="23151" on @this.Html.CheckBoxFor(...)
2021-11-09 jQuery.validator.unobtrusive.adapters.addMinMax round trips, doesn't work in MVC3
2021-11-09 Debug a script that sits in a partial view
2021-11-09 Windows Services Recovery option doesn't work ... or I don't understand it RRS feed
2017-11-09 chrome的F12的inspect使用
2017-11-09 Macro expressions in kentico