判断json是否为空

文章目录

  • 一、判断json是否为空

一、判断json是否为空

// 示例json数据

String jsonStr = “{“name”:“张三”,“age”:25,“gender”:“男”}”;

// 将json数据转换为JSONObject对象

JSONObject json = JSONObject.parseObject(jsonStr);

// 判断JSONObject对象是否为空

if (json != null && !json.isEmpty()) {

// 不为空的处理逻辑

}

本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://net2asp.com/c51724b684.html