I wanted to know what the euqivalent of the Newtonsoft.Json's / Json.Net's JsonProperty
field in System.Text.Json is.
Example:
using Newtonsoft.Json;
public class Example
{
[JsonProperty("test2")]
public string Test { get; set; }
}
References:
Json does case-insensitive property name matching by default. The System. Text. Json default is case-sensitive, which gives better performance since it's doing an exact match.
Newtonsoft is the creator/publisher (the company), and JSON.NET is the product name. It's the same thing.
Instructs the JsonSerializer to always serialize the member with the specified name. Attribute. Newtonsoft.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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With