net.sf.json.JSONException: 'object' is an array. Use JSONArray instead
list集合轉換JSON出錯誤
意思是:物件”是一個陣列。使用jsonarray代替。
解決方法:
將JSONObject替換為JSONArray
程式碼:
JsonConfig jsonConfig = new JsonConfig();
jsonConfig.setCycleDetectionStrategy(CycleDetectionStrategy.LENIENT);
JSONArray json = JSONArray.fromObject(newList, jsonConfig);
result = json.toString();
相關文章
- Use SQLite Instead of Local Storage In Ionic FrameworkSQLiteFramework
- Use KTPASS instead of adden to configure mssql.keytabSQL
- 【已解決】ImportError: torch.utils.ffi is deprecated. Please use cpp extensions instead.ImportError
- JSONObject和JSONArrayJSONObject
- Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android ToolAndroidUICompile
- JSONObject與JSONArray的使用JSONObject
- JsonArray和JsonObject遍歷方法JSONObject
- 如何區分jsonarray 和 jsonobjectJSONObject
- 【轉載】Kano Model — Ways to use it and NOT use it
- Oracle Instead of Trigger的用法Oracle
- Oracle Instead of 觸發器的使用Oracle觸發器
- the "in" use in mysqlMySql
- JSONObject與JSONArray 解析JSON格式字串JSONObject字串
- oracle hint_use_concat_use_nl_with_indexOracleIndex
- go 處理 jsonArray 無 key 的 JSON 串GoJSON
- js遍歷拼接list集合物件,JSONArray陣列物件JSON陣列
- plsql use skillsSQL
- GPFS use with OracleOracle
- how to use typeset?
- USE EXPLAIN PLANAI
- java實現將excel表格資料解析成JSONArrayJavaExcelJSON
- hadoop報:could only be replicated to 0 nodes, instead of 1Hadoop
- Uncaught TypeError: Object [object Object] has no method 'xxx'ErrorObject
- Use PHP7PHP
- IPFS_basic_use
- how to use coffee script
- Use index_descIndex
- why use dynamic SQL?SQL
- In Oracle,How to use dumpOracle
- js獲取返回jsonArray中最後一個物件的idJSON物件
- Oracle Hint:USE_NL、USE_MERGE、UESE_HASH(原理)Oracle
- hadoop報錯:could only be replicated to 0 nodes, instead of 1Hadoop
- objectObject
- 介面返回[object,Object]解決方法Object
- Effective Object C 2.0 『熟悉Object C』Object
- JavaScript中將JSONArray文字內容轉JSON物件陣列JavaScriptJSON物件陣列
- the NTP socket is in use, exiting
- 嚴格模式use strict模式