草庐IT

PersonReference

全部标签

c# - 如何使用 JSON.NET 的自定义引用解析

我有以下JSON:{"id":"2""categoryId":"35""type":"item""name":"hamburger"}{"id":"35""type":"category""name":"drinks"}我想将它与这个对象匹配:publicclassItem{[JsonProperty(PropertyName="categoryId")]publicCategoryCategory{get;set;}}Category属于Entity类型,它具有我可以访问的stringId属性。我希望将JSONDeserializer创建的“35”对象映射到Item中的Categor