C
C#2y ago
Kiel

How does Newtonsoft.Json.JsonConverter handle nullable structs?

I'm presently writing a JsonConverter for a third-party struct, and in my json models that field can be null/omitted. Do I need to explicitly write a JsonConverter<MyStruct?> or will the non-nullable one handle that behavior as well?
2 Replies
Monsieur Wholesome
json.net can handle nullable, whatever is behind the nullable
Chiyoko_S
Chiyoko_S2y ago
I'd expect it to "just work" as long as you have the types specified properly