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

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.
All = 3

Preserve references when serializing.

Arrays = 2

Preserve references when serializing into a JSON array structure.

None = 0

Do not preserve references when serializing types.

Objects = 1

Preserve references when serializing into a JSON object structure.