判断字符串是JSONObject 还是JSONArray?

Object json = new JSONTokener(jsonResponse).nextValue();
if (json instanceof JSONObject) {
    JSONObject jsonObject = (JSONObject) json;

} else if (json instanceof JSONArray){
    JSONArray jsonArray = (JSONArray) json;
    

猜你喜欢

转载自blog.csdn.net/jiabaokang/article/details/75579008