<PackageReference Include="Newtonsoft.Json" Version="10.0.1" />

PreserveReferencesHandling

Specifies reference handling options for the JsonSerializer. Note that references cannot be preserved when a value is set via a non-default constructor such as types that implement ISerializable.
using System; namespace Newtonsoft.Json { [Flags] public enum PreserveReferencesHandling { None = 0, Objects = 1, Arrays = 2, All = 3 } }