unityloverz 发表于 2022-6-5 16:28

【Unity】Json序列化报错Self referencing loop detected for property

问题记录:

Self referencing loop detected for property 'ParentClassify' with type 'System.Data.Entity.DynamicProxies.Classify_A1F38FCCD6F018E5AEE129BF1636404F78C4F0F625B17FCC6A9B5AFDC8A5E1BF'. Path '.ChildrenClassifys'.

描述:

自我引用循环探测到类型ParentClassify System.Data.Entity.DynamicProxies.Classify_A1F38FCCD6F018E5AEE129BF1636404F78C4F0F625B17FCC6A9B5AFDC8A5E1BF”型。路径”.ChildrenClassifys”。

解决办法:

JsonSerializerSettings settings = new JsonSerializerSettings();

settings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;

ViewBag.ClassifyJsonStr = JsonConvert.SerializeObject(classifylist, settings);

————————————————

版权声明:本文为CSDN博主「樱Cherry桃」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。

原文链接:https://blog.csdn.net/fy809178958/article/details/77930549
页: [1]
查看完整版本: 【Unity】Json序列化报错Self referencing loop detected for property