码迷,mamicode.com
首页 > 其他好文 > 详细

Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2

时间:2018-01-17 12:32:49      阅读:609      评论:0      收藏:0      [点我收藏+]

标签:live   expected   column   substr   on()   substring   方法   style   expec   

原因是解析的时候多了,逗号,或是 \

解决方法:
revJson=revJson.replace("\\", "");//去掉‘/‘
revJson=revJson.substring(1, revJson.length()-1); //去掉头尾引号。
 
简单对象解析:
 BeanOrderIntent beanOrder = (BeanOrderIntent) DubJson.fromJson(result, BeanOrderIntent.class);
 
List解析
Gson gson = new Gson();
List<BeanOrderConfirm> beanOrderConfirm = gson.fromJson(deliveryData, new TypeToken<List<BeanOrderConfirm>>() {}.getType());

 

Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2

标签:live   expected   column   substr   on()   substring   方法   style   expec   

原文地址:https://www.cnblogs.com/dubo-/p/8301967.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!