Attribute JsonProperty works incorrect with .NET Core 3.1 when I use underscore symbol

Also you can use [JsonPropertyName("model")] attribute instead of [JsonPropertyAttribute("model")] if you want to use native System.Text.Json for .net core 3.1


.NET Core 3.* is using System.Text.Json by default and it doesn't work with JsonPropertyAttribute class.

You need to install Microsoft.AspNetCore.Mvc.NewtonsoftJson.

Install-Package Microsoft.AspNetCore.Mvc.NewtonsoftJson

And call AddNewtonsoftJson extension method to set ASP.NET Core project to use Newtonsoft.Json packages.

services.AddControllers().AddNewtonsoftJson();

Related links

Using Newtonsoft.Json In .NET Core 3+ Projects