Я хотел знать, каков эквивалент поля JsonProperty Newtonsoft.Json's / Json.Net в System.Text.Json.
JsonProperty
Пример:
using Newtonsoft.Json; public class Example { [JsonProperty("test2")] public string Test { get; set; } }
Ссылки:
На всякий случай, кто-то еще падает на это. Свойство переименовывается в JsonPropertyName и приходит от System.Text.Json.Serialization в пакете System.Text.Json.
JsonPropertyName
System.Text.Json.Serialization
System.Text.Json
using System.Text.Json.Serialization; public class Example { [JsonPropertyName("test2")] public string Test { get; set; } }