#r "nuget:Utf8Json" using Utf8Json; using System.Runtime.Serialization; using System.Collections.Generic; using System.Collections.ObjectModel; public class Item { public string Name {get;set;} public int Value {get;set;} public double Weight {get;set;} [IgnoreDataMember] public ItemCollection Parent {get;set;} } public class ItemCollection : KeyedCollection { protected override string GetKeyForItem(Item item) { return item.Name; } } var first = new Item() {Name = "ddd", Value = 5, Weight = 54.2}; Console.WriteLine( JsonSerializer.ToJsonString(first)); var Col = new ItemCollection(); Col.Add(first); Console.WriteLine( JsonSerializer.ToJsonString(Col)); var ColDes = JsonSerializer.Deserialize(JsonSerializer.ToJsonString(Col));