HTTP请求数据返回解析Josn org.codehaus.jackson.map.JsonMappingException的解决方法
来源:互联网 发布:linux权限管理root 编辑:程序博客网 时间:2024/05/01 08:02
用http向服务器发起请求,解析返回数据出现Josn org.codehaus.jackson.map.JsonMappingException
问题代码:
public void onSuccess(ResponseInfo<String> responseInfo) {
ObjectResponse<CommCarCurrentLoInfoEntity> response = ResponseParser.toObjectResponse
.toListResponse(responseInfo.result,
CommCarCurrentLoInfoEntity.class);
if (response != null) {
CommCarCurrentLoInfoEntity data = response.getData();
lastPoint = new LatLng(data.getLoLtt()
.doubleValue(), data.getLoLgt()
.doubleValue());
}
返回数据:
抛异常的原因:
返回的result 里头的data是个list,即使你知道只返回一个实例。所以不能用ResponseParser.toObjectResponse来解析,而应该用ResponseParser.toListResponse来解析。
正确代码:
public void onSuccess(ResponseInfo<String> responseInfo) {
ListResponse<CommCarCurrentLoInfoEntity> response = ResponseParser
.toListResponse(responseInfo.result,
CommCarCurrentLoInfoEntity.class);
if (response != null) {
List<CommCarCurrentLoInfoEntity> data = response.getData();
if (data.size() >0) {
lastPoint = new LatLng(data.get(0).getLoLtt()
.doubleValue(), data.get(0).getLoLgt()
.doubleValue());
}
- HTTP请求数据返回解析Josn org.codehaus.jackson.map.JsonMappingException的解决方法
- org.codehaus.jackson.map.JsonMappingException: Infinite recursion的解决
- Jackson报错org.codehaus.jackson.map.JsonMappingException
- hadoop出现ava.lang.ClassNotFoundException: org.codehaus.jackson.map.JsonMappingException
- org.codehaus.jackson.map.JsonMappingException: No serializer found for class
- org.codehaus.jackson.map.JsonMappingException: Can not deserialize
- springmvc+hibernate时Jackson报错org.codehaus.jackson.map.JsonMappingException
- org.codehaus.jackson.map.JsonMappingException: No serializer found for class org.hibernate.proxy....
- org.codehaus.jackson.map.JsonMappingException: No suitable constructor found for type [si
- org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.ArrayList o
- org.codehaus.jackson.map包下的ObjectMapper类源码
- 解析json之org.codehaus.jackson
- springmvc返回json报错:java.lang.NoSuchMethodError: org.codehaus.jackson.map.SerializationConfig.isEnable
- 包引用冲突 Jackson : NoSuchMethodError for org.codehaus.jackson.map...
- [javase][json] org.codehaus.jackson的使用
- Spring3.2与jackson2的问题 java.lang.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper
- 项目启动报错.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper
- Could not find class 'org.codehaus.jackson.map.MappingJsonFactory'
- function与感叹号
- 高通平台环境搭建,编译,系统引导流程分析
- 百度卫士最新版更新版源码下载
- typedef用法总结
- list转树JSON
- HTTP请求数据返回解析Josn org.codehaus.jackson.map.JsonMappingException的解决方法
- 浅淡Webservice、WSDL三种服务访问的方式
- Xcode Keyboard Shortcuts-Xcode键盘快捷方式
- Bad Push-让人恍然大悟的14种错误推送方式
- poj 3613
- Qt:quick和C++双向传递图片
- [BZOJ1041]HAOI2008圆上的整点
- 看到的一个笑话
- Android setVisibility的总结~