79101824

Date: 2024-10-18 11:22:27
Score: 1
Natty:
Report link

For those not wanting to use the Newtonsoft.Json Package and instead want to use the System.Text.Json.Serialization Package, you can alternatively use this:

[JsonPropertyName("foo")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Foo { get; set; }

JsonIgnoreCondition Documentation

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Joe C