Asp.Net Core Web API 2.2 Controller not returning complete JSON
I see you are using Eager Loading
in your query. So add the following configuration in your Startup
class to ignore cycles that it finds in the object graph and to generate JSON
response properly.
public void ConfigureServices(IServiceCollection services)
{
...
services.AddMvc()
.AddJsonOptions(
options => options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
);
...
}
For more details: Related data and serialization in EF Core