com.alibaba.fastjson.JSONArray cannot be cast to com.alibaba.fastjson.JSONObject

com.alibaba.fastjson.JSONArray cannot be cast to com.alibaba.fastjson.JSONObject
json中类型转换问题,[{}]是错误的格式。如下面我的写法:

JSONObject.parseObject("[{\"type\":\"slider\",\"show\":\"true\",\"start\":1,\"end\":100}]");

正确的写法为:

JSONObject[] dataZoom = new JSONObject[]{JSONObject.parseObject("{\"type\":\"slider\",\"show\":\"true\",\"start\":1,\"end\":100}")};

你可能感兴趣的:(java学习笔记)