com.alibaba.fastjson.JSONException: syntax error, expect {, actual [, pos 0
来源:互联网 发布:sql中decode 编辑:程序博客网 时间:2024/05/22 15:33
在使用fastjson解析的时候遇到该错误,网上查找了半天,找到位大神的帖子是说解析的实体A中有实体B,在该条json中A实体只有一个,但B实体却有多个,导致解析出错,解决办法是在A实体中定义B实体时,定义为List<B>,这个是大神当时遇到的错误。我的错误不在于此。
我的错误是由于在封装json时封装的实体时List类型的,但解析的时候默认解析为一个实体,所以就出现了以上的错误
解析时的代码Moyiol_order mOrder=JSON.parseObject(ordersinfo, Moyiol_order.class);
封装时的代码List<Moyiol_order> result;
JSON.toJSONString(result);
只要在封装的时候将result取出要用的实体封装就可以了,如果需要封装多个实体,可以借鉴大神的思想自己寻找一下方法。
http://blog.csdn.net/jadyer/article/details/24395015
1 2
- com.alibaba.fastjson.JSONException: syntax error, expect {, actual [, pos 0
- com.alibaba.fastjson.JSONException: syntax error, expect {, actual int, pos 0
- com.alibaba.fastjson.JSONException: syntax error, expect {, actual int, pos 0
- com.alibaba.fastjson.JSONException: syntax error, expect {, actual error
- fastJson --JSONException syntax error, expect {, actual string, pos...
- com.alibaba.fastjson.JSONException: syntax error, pos 1
- Exception in thread "AWT-EventQueue-0" com.alibaba.fastjson.JSONException: syntax error, unexpect t
- com.alibaba.druid.sql.parser.ParserException: syntax error,expect IS, actual EQ id
- com.alibaba.fastjson.JSONException: error parse e
- com.alibaba.fastjson.JSONException: not close json text, token : error
- com.alibaba.fastjson.JSONException: not close json text, token : error
- FastJson syntax error, pos 19
- fastJson解析报错com.alibaba.fastjson.JSONException: create instance error, class json.TestFJson$A
- fastJson解析报错com.alibaba.fastjson.JSONException: create instance error...
- fastJson解析报错com.alibaba.fastjson.JSONException: create instance error...
- com.alibaba.fastjson.JSONException: unclosed string
- com.alibaba.fastjson.JSOnException:exepct '[' ,but {
- com.alibaba.fastjson.JSOnException:exepct '[' ,but {
- Android之TextView(控件)
- Xcode 各个版本下载地址
- Mac&iOS Socket
- java.lang.OutOfMemoryError: Java heap space 的解决
- JavaEE_SSM_Mybatis Mybatis 学习指南
- com.alibaba.fastjson.JSONException: syntax error, expect {, actual [, pos 0
- 3-3-行编辑程序-栈和队列-第3章-《数据结构》课本源码-严蔚敏吴伟民版
- C# - 程序的执行
- composer 的初步使用
- IOS探索之从拍照中获取图像对应的ALAsset
- 上推动画下拉刷新上拉加载
- android 去掉标题栏和全屏,横竖屏强制转换
- 实践自定义UI—RLF...(RelativeLayout LinearLayout FrameLayout....)
- Unity3d在安卓android的更新(APK覆盖)