Exception in thread “main” com.alibaba.fastjson.JSONException: syntax error, expect [, actual string, pos 0, fieldName null
终极解决办法:
System.out.println(JSON.parseArray(JSONObject.toJSONString("ddddd")));
问题产生的原因是JSON.parseArray转换的不是一个数组结构,所以报错,下面是解决方案
代码如下:
JSON.parseArray("[" + JSONObject.toJSONString("newData") + "]")