What is the equivalent of Newtonsoft.Json's / Json.Net's JsonProperty field in System.Text.Json? What is the equivalent of Newtonsoft.Json's / Json.Net's JsonProperty field in System.Text.Json? json json

What is the equivalent of Newtonsoft.Json's / Json.Net's JsonProperty field in System.Text.Json?


Just in case, anyone else falls over this. The property is renamed to JsonPropertyName and comes from System.Text.Json.Serialization in the System.Text.Json nuget package.

Example:

using System.Text.Json.Serialization;public class Example{    [JsonPropertyName("test2")]    public string Test { get; set; }}

References: