jackson json转实体 com.fasterxml.jackson.databind.exc.UnrecognizedPropertyExceptionhtml
jackson 2.2.2java
因为vo中缺乏json的某个字段属性引发json
3种解决方法数组
一、 vo中添加注解 @JsonIgnoreProperties(ignoreUnknown = true),在实体类上加上注解app
二、 mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);post
三、 添加以下便可:mapper.configure(DeserializationFeature.ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT, true);,把空的数组“[]”转为空spa
com.fasterxml.jackson.databind.exc.MismatchedInputExceptioncode
错误的格式xml
[{ "firstName": "hgf", "lastName": "frew", "username": "erf", "email": "bgghjk", "password": "bgte", "role": "trrere" } ]
正确的格式,不要[]htm
{ "firstName": "hgf", "lastName": "frew", "username": "erf", "email": "bgghjk", "password": "bgte", "role": "trrere" }