Tost
Tost
CC#
Created by Tost on 3/12/2024 in #help
(SQL Server) EF Core 8 not respecting JsonIgnore
Hello, I have a json complex property that is being translated to json with ToJson() , some of the properties of the complex property can be null. Now, I want those nullable properties when they are null, not to be written to the json representation. I already tried to use JsonIgnoreAttribute with Condition = JsonIgnoreCondition.WhenWritingNull but EF Core ignores them for some reason. Is there a special attribute that I can use or Fluent API for this behavior? (model) https://pastebin.com/qHDFT4VT
13 replies