1.Exception in thread "main" com.alibaba.fastjson.JSONException: syntax error, expect {, actual ]
就是說實際上想要的是{},而不是[]
錯誤案例: String request = "[\"data\"=\"today\", \"type\"=\"JSON\"]"
(只要是這種都是格式不正確,還有比如syntax error, expect :, actual =等等)
錯誤案例: String request = "{\"data\"=\"today\", \"type\"=\"JSON\"}"
2.com.alibaba.fastjson.JSONException: syntax error,
錯誤案例: String request = "{data:today, type:JSON}";
正確案例:String request = "{\"data\":\"today\", \"type\":\"JSON\"}";
JSONObject obj = JSON.parseObject(request);