In my web api when i run project for get data from database got this error .net core 3.1
JsonException: A possible object cycle was detected which is not
Finally fixed mine with System.Text.Json not NewtonSoft.Json using
var options = new JsonSerializerOptions() { MaxDepth = 0, IgnoreNullValues = true, IgnoreReadOnlyProperties = true };
Using options to serialize
objstr = JsonSerializer.Serialize(obj,options);