On Thu, Apr 4, 2019 at 10:01 PM Alexandru Ionita <[email protected]> wrote: > > Please forgive my ignorance and lack of library knowledge, but: > > My concern is related to how the missing properties are mapped to null by > default. > > Wouldn't be a good idea to have the @JsonSetter annotation handle the > properties classified as missing in a similar fashion as the nulls are > handled? > I mean, it would be handy to have the possibility to say > @JsonSetter(missing=Missings.SKIP) or @JsonSetter(missing=Missings.AS_EMPTY). > This is useful in the context of explicitly setting a property to null or > implicitly on missing, leaving the developer with some space of maneuver in > regards to the deserialization process. > > If there are other means to achieve this functionality, I'd be grateful to > know how to use.
Jackson has no concept of "missing" properties at this point; no action is taken except for limited case of enforcing `required` property with `@JsonCreator`. So although it might make sense to have similar functionality for "absent" as for `null`, there is nothing to add that on as things are. I have thought of addressing this for 3.0, but work to start keeping track of existence is non-trivial, and there's overhead of keeping this information. So for time being there is no functionality to do anything about absent values. -+ Tatu +- -- You received this message because you are subscribed to the Google Groups "jackson-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
