Closed BrianVallelunga closed 8 months ago
We're having the exact same problem. It would be nice if it treated null and absence the same way when deserializing (with the given options).
Same here.
I have the same issue. In an API I want to allow a user to either not send an optional field or send it as null,
However using the default options makes optional fields required and using WithSkippableOptionFields
will set a null value to Some null
. I would a configuration where they both would be None.
Also it seems like issue is similar to #151
This is released in v1.3.13:
JsonFSharpOptions.Default()
.WithSkippableOptionFields(SkippableOptionFields.Always, deserializeNullAsNone = true)
Thanks! I'm going to test this today.
Works great, thanks
I'm having a hard time figuring out exactly how to handle null or missing JSON fields when deserializing a record. My serializer settings are currently:
I don't care much about how an
Option
type gets serialized. Eithernull
or as a missing field is fine by me, but when deserializing I want bothnull
and missing fields to deserialize asNone
. Right now I'm getting errors ifnull
is present. Is there a magic set of options that gets me the behavior I want? Thanks for the help.