文章目录 一、判断json是否为空 一、判断json是否为空 // 示例json数据 String jsonStr = “{“name”:“张三”,“age”:25,“gender”:“男”}”; // 将json数据转换为JSONObject对象 JSONObject json = JSONObject.parseObject(jsonStr); // 判断JSONObject对象是否为空 if (json != null && !json.isEmpty()) { // 不为空的处理逻辑 }