AWS Lambda json deserialization with jackson annotations

后端 未结 5 1652
生来不讨喜
生来不讨喜 2021-01-07 22:43

I\'m calling an aws lambda with a json body. So the fields of the json are with different name from the ones in the POJO. So what I did is to add @JsonProperty on the fields

5条回答
  •  别那么骄傲
    2021-01-07 23:22

    It sounds like you have version mismatch between annotation types, and databind (ObjectMapper): both MUST be the same major version. Specifically, Jackson 1.x annotations work with Jackson 1.x databind; and 2.x with 2.x.

    Difference is visible via Java package: Jackson 1.x uses org.codehaus.jackson, whereas Jackson 2.x uses com.fasterxml.jackson. Make sure to import right annotations for ObjectMapper you use.

提交回复
热议问题