I have a mssql database for my website within 4 tables.
When I use this:
public static string GetAllEventsForJSON()
{
using (CyberDBDataContext d
I am using Dot.Net Core 3.1 and did an search for
"Newtonsoft.Json.JsonSerializationException: Self referencing loop detected for property "
I am adding this to this question, as it will be an easy reference. You should use the following in the Startup.cs file:
services.AddControllers()
.AddNewtonsoftJson(options =>
{
// Use the default property (Pascal) casing
options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
});