Closed TranquilMarmot closed 11 months ago
Sure! You ought to be able to just use the underlying Newtonsoft attribute for it (this is what ColumnAttribute
is doing behind the scenes anyway). Just specify the property on the object that you want to be ignored.
Something like:
public record GameState
{
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string? ExampleProperty { get; set; }
}
Works perfectly! Thank you!
Feature request
Is your feature request related to a problem? Please describe.
I have a JSONB column that I'm writing to, defined like this:
This will write the following JSON to the JSONB column:
Describe the solution you'd like
This is mostly fine, but it would be nice to be able to ignore
null
values when serializing to JSONB.Describe alternatives you've considered
I tried to define the column like so:
But that doesn't have an effect. I assume because it applies to the entire column, and not the individual fields in the serialized JSON value.