java.lang.ClassCastException: com.alibaba.fastjson.JSONObject cannot be cast to com.
前言
阿里json轉換報錯
java.lang.ClassCastException: com.alibaba.fastjson.JSONObject cannot be cast to com.picc.vo.WxUserVo
問題
// List<WxUserVo> wxUserVos = (List<WxUserVo> )jsonObject.get("userlist");
Object userlist = jsonObject.get("userlist");
List<WxUserVo> wxUserVos = JSONObject.parseArray(userlist.toString(), WxUserVo.class);
原因
註釋部分轉換,的時候debug可以通過 但是迴圈一定會報錯,需要分成兩部,先拿到批量的json字串,在指定轉換型別,這樣就不會報錯,我覺得阿里可以優化下這個問題
相關文章
- com.alibaba.fastjson.JSONObject cannot be cast to XXX異常解決ASTJSONObject
- java.lang.String cannot be cast to com.alibaba.fastjson.JSONObject解決辦法JavaASTJSONObject
- java.lang.ClassCastException: android.widget.FrameLayout$LayoutParams cannot be cast to android.widgJavaASTExceptionAndroid
- Cause: java.lang.ClassCastException: java.lang.String cannot be cast to org.apache.ibatis.mapping.MappedStatementJavaASTExceptionApacheBATAPP
- cannot be cast to java.lang.ComparableASTJava
- 解決String cannot be cast to java.util.List報錯ASTJava
- android.app.Application cannot be cast to 新建的ApplicationAndroidAPPAST
- Android ContextThemeWrapper cannot be cast to android.app.ActivityAndroidContextAPPAST
- 關於利用動態代理手寫資料庫連線池的異常 java.lang.ClassCastException: com.sun.proxy.$Proxy0 cannot be cast to java.sql.Connection資料庫JavaASTExceptionSQL
- SQL中欄位比較型別不匹配錯誤:‘cannot be cast to’SQL型別AST
- JAVA int 強制型別轉換錯誤提示(Cannot cast from Object to int)Java型別ASTObject
- C++之static_cast,dynamic_cast,const_castC++AST
- 7.41 CASTAST
- C++強制型別轉換:static_cast、dynamic_cast、const_cast、reinterpret_castC++型別AST
- teradata CASTAST
- oracle cast 用法OracleAST
- dynamic_castAST
- static_cast與dynamic_cast到底是什麼?AST
- reinterpret_cast 和 static_cast 的區別AST
- springboot mybatis Java.lang.ClassCastExceptionSpring BootMyBatisJavaASTException
- C++中static_cast, dynamic_cast, const_cast用法/使用情況及區別解析C++AST
- Laravel 5 Eloquent cast arrayLaravelAST
- Oracle的Cast的用法OracleAST
- oracle function函式castOracleFunction函式AST
- 型別轉換(cast)型別AST
- C++中dynamic_cast與static_cast淺析與例項演示C++AST
- static_cast和dynamic_cast的區別,看完這篇你就懂了!AST
- SQL中的cast()函式SQLAST函式
- const_cast的用法AST
- Oracle CAST函式不生效OracleAST函式
- Hadoop中java.lang.ClassCastException: partition解決方法HadoopJavaASTException
- Exception in thread "main" java.lang.ClassCastException: $Proxy13ExceptionthreadAIJavaAST
- Golang 型別轉換庫 castGolang型別AST
- substr,substrb,cast的使用、比較AST
- oracle 特殊SQL(TABLE( CAST( MULTISET()[zt]OracleSQLAST
- cast函式的用法案例AST函式
- (轉)Go 每日一庫之 castGoAST
- java.lang.ClassCastException: org.apache.struts.taglib.bean.CookieTeiJavaASTExceptionApacheBeanCookie