java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $
来源:互联网 发布:mysql修复表命令 编辑:程序博客网 时间:2024/05/25 18:12
Gson的代码
mJsonDataFromAssets = JAssetsUtils.getJsonDataFromAssets(this, "chineseCountryJson.json");Gson gson = new Gson();List<ContryCodeBean> contryList = gson.fromJson(mJsonDataFromAssets, new TypeToken<List<ContryCodeBean>>() {}.getType());
json数据
{
"data": [
{
"countryName": "安道尔",
"countryPinyin": "andao er",
"phoneCode":"376",
"countryCode":"AD"
},
{
"countryName": "阿拉伯联合酋长国",
"countryPinyin": "ala bo lian he qiu zhang guo",
"phoneCode":"971",
"countryCode":"AE"
}
]
}public class ContryCodeBean implements Serializable { private List<DataBean> data; public List<DataBean> getData() { return data; } public void setData(List<DataBean> data) { this.data = data; } @Setter @Getter public static class DataBean implements Serializable{ /** * countryName : 安道尔 * countryPinyin : an dao er * phoneCode : 376 * countryCode : AD */ private String country_name; private String country_pinyin; private String phone_code; private String country_code; }}
解决办法
把json数据改成了
[ { "data": [ { "countryName": "安道尔", "countryPinyin": "an dao er", "phoneCode": "376", "countryCode": "AD" }, { "countryName": "阿拉伯联合酋长国", "countryPinyin": "a la bo lian he qiu zhang guo", "phoneCode": "971", "countryCode": "AE" }]}]解决问题
阅读全文
0 0
- java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
- java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $
- java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 34 path
- java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 81
- java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 39 path $
- android json解析java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1报错
- android 错误java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1
- Gson 解析时候报错: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
- Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path 解决办法
- Gson 解析时候报错: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
- Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path 解决办法
- Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 498
- java.lang.IllegalStateException: Expected BEGIN_OBJECT but was was STRING at line 1 column 1
- retrofit加载失败java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1...
- Excepted BEGIN_OBJECT but was BEGIN_ARRAY at line1 column 2path
- Expected BEGIN_OBJECT but was BEGIN_ARRARY at line 1 column 2 path$异常解决方法
- IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 616
- android报错 Expected BEGIN_OBJECT but was STRING at line 1 column 39 path $
- Java中的深拷贝(深复制)和浅拷贝(浅复制)
- 如何取url中的参数
- IOS 身份证校验
- C++写时拷贝(测试用例String类)
- No adapter for handler [public boolean com.fuying.assure.user.login.action.UserManageAction.validIdN
- java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $
- 关于descriptionWithLocale和NSLog数组/字典时中文显示unicode
- 总结几种排序算法(一)---冒泡排序
- TensorFlow中,variable_scope和name_scope的不同之处
- iOS UserDefaults存储自定义对象
- 联合体(union)的使用方法及其本质
- ZK框架的分析与应用
- mysql游标
- 算法系列——Copy List with Random Pointer