📌  相关文章
📜  Newtonsoft.Json.JsonSerializationException: '检测到属性的自引用循环 - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:58.460000             🧑  作者: Mango

代码示例1
// It seems that you have a reacurring properties in your object.
// You can either clean up your object and make sure you are not getting
// The properties multiple times OR you can tell your serializer 
// That this is acceptable behavior like this:

var settings = new Newtonsoft.Json.JsonSerializerSettings();
// This tells your serializer that multiple references are okay.
settings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;

return JsonConvert.SerializeObject(, settings);