JAVA中 fastjson判断JSONObject是否为空
package com.map;
import com.alibaba.fastjson.JSONObject;
/**
* 判断JSONObject是否为空
* @author luolei
* @date 2019年2月14日
*/
public class FastJSONTest {
public static void main(String[] args){
JSONObject obj = new JSONObject();
System.out.println(obj.isEmpty()); //true
obj.put("name", "luolei");
System.out.println(obj.isEmpty()); //false
}
}
个人网站欢迎来访
本文介绍了一种使用FastJSON库中的JSONObject类判断对象是否为空的方法。通过实例演示了如何利用isEmpty()方法检查JSONObject实例的内容是否为空,对于进行数据校验和处理提供了便捷的途径。
1881

被折叠的 条评论
为什么被折叠?



