JavaBean中Integer类型为null时,转为json依然为null

来源:互联网 发布:php会员中心 源码 编辑:程序博客网 时间:2024/06/17 01:27
JsonConfig jsonConfig = new JsonConfig(); jsonConfig.registerDefaultValueProcessor(Integer.class, //定义Integer为null时   转为json 还是nullnew DefaultValueProcessor(){public Object getDefaultValue(Class type) {                return null;                 }  });JSONObject json = JSONObject.fromObject(JavaBean,jsonConfig);

阅读全文
0 0
原创粉丝点击