问题描述
- JsonMappingException问题,求大神解答
-
求大神解答:
从服务器获取了一段json,现在要转成bean.上代码:
public static Object Json2Gson( Class<?> clz,String jsonString) throws IOException {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
return objectMapper.readValue(jsonString, clz);
}但是解析报错了:
cn.serviceforce.cssdk.jackson.databind.JsonMappingException:
Conflicting setter definitions for property "imagePath":
android.graphics.Bitmap#setImagePath(1 params)
vs android.graphics.Bitmap#setImagePath(1 params)什么原因呢,求大神解答啊
解决方案
说明你的bean结构和json结构不一致导致,你可以用谷歌的gson包,很方便
时间: 2024-10-25 06:17:16