Json Property Names in Dotnet Core 3.x

TL;DR

Pre-Dotnet Core 3.0 uses the format below to map incoming json properties to C# model properties

#
1
2
3
4
5
6
public class Model
{
[JsonProperty("first_name")]
public string FirstName

}

Dotnet Core 3.x now uses

#
1
2
3
4
5
6
public class Model
{
[JsonPropertyName("first_name")]
public string FirstName

}

Attempting to use the first version in a Dotnet Core 3.x Application will fail to bind and those properties will be null.

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×