java判断JSON字符串是JSONObject或JSONArray
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
String xssJson = "{\"name\":\"\",\"age\":\"\"}";
Object object = JSON.parse(json);
if (object instanceof JSONObject) {
JSONObject jsonObject = (JSONObject) object;
log.info(" jsonObject:" + jsonObject.toJSONString());
} else if (object instanceof JSONArray) {
JSONArray jsonArray = (JSONArray) object;
log.info(" jsonArray:" + jsonArray.toJSONString());
}