jackson json轉實體 com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException
jackson 2.2.2
由於vo中缺少json的某個字段屬性引起
2種解決方法
1:vo中添加註解@JsonIgnoreProperties(ignoreUnknown = true)
2. mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
com.fasterxml.jackson.databind.exc.MismatchedInputException
錯誤的格式
[{
"firstName": "hgf",
"lastName": "frew",
"username": "erf",
"email": "bgghjk",
"password": "bgte",
"role": "trrere"
}
]
正確的格式,不要[]
{
"firstName": "hgf",
"lastName": "frew",
"username": "erf",
"email": "bgghjk",
"password": "bgte",
"role": "trrere"
}