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

Newtonsoft.Json.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.
namespace Newtonsoft.Json { public enum PreserveReferencesHandling { None = 0, Objects = 1, Arrays = 2, All = 3 } }