i am getting issue with services.AddMvc(options => {
options.Filters.Add(new AuthorizeFilter("default"));
}).AddJsonOptions(x => x.SerializerSettings.ReferenceLoopHandling =
Newtonsoft.Json.ReferenceLoopHandling.Serialize) 'JsonOptions' does
not contain a definition for 'SerializerSettings'
For asp.net core 3.0+,you need to install the package Microsoft.AspNetCore.Mvc.NewtonsoftJson for your version firstly,then replace
services.AddMvc()
.AddJsonOptions(
options => options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize);
with
services.AddControllersWithViews()
.AddNewtonsoftJson(options =>
options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize);
Refer to https://learn.microsoft.com/en-us/aspnet/core/migration/22-to-30?view=aspnetcore-3.1&tabs=visual-studio#use-newtonsoftjson-in-an-aspnet-core-30-mvc-project