Newtonsoft.Json.JsonSerializationException “Self referencing loop detected” in library code

前端 未结 1 1008
北荒
北荒 2021-01-22 09:56

I have self referencing data: each Item contains a list of Scrapbooks that it is a member of and each Scrapbook contains a list of Items it contains. Clearly that\'s circular, a

相关标签:
1条回答
  • 2021-01-22 10:34

    It looks like all I need to do is add the IsReference attribute to my Item class:

    [JsonObject(IsReference = true)]
    public class Item
    

    (as suggested as Fix 3 in Boshoy's answer to a similar question).

    0 讨论(0)
提交回复
热议问题