JsonIgnore attribute keeps serializing properties in ASP.NET Core 3
[JsonIgnore]
is an JSON.NET attribute and won't be used by the new System.Text.Json
serializer.
Since your application is an ASP.NET Core 3.0 System.Text.Json
will be used by default. If you want to continue to consume the JSON.NET annotations, you have to use JSON.NET in ASP.NET Core 3
It's as easy as adding .AddNewtonsoftJson()
to your MVC or WebApi Builder
services.AddMvc()
.AddNewtonsoftJson();
or
services.AddControllers()
.AddNewtonsoftJson();
for WebAPI-esque applications.