Jackson: What happens if a property is missing?

后端 未结 6 850
北恋
北恋 2020-12-01 02:01

What happens if I annotate a constructor parameter using @JsonProperty but the Json doesn\'t specify that property. What value does the constructor get?

6条回答
  •  南方客
    南方客 (楼主)
    2020-12-01 02:34

    another option is to validate the object after deserialization either manually or via frameworks such java bean validation or, if you are using spring, the spring validation support.

提交回复
热议问题