What is the equivalent of Newtonsoft.Json’s JsonProperty attribute 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:

  • Try the new System.Text.Json APIs
  • JsonProperty.Name Property –> Not yet documented properly…

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)