JSONObject過濾

配置:
    JsonConfig config=new JsonConfig();
config.setArrayMode(1);//設置數組的轉換模式,1是啥我暫時不知道
config.setClassMap(new HashMap(){{put("user",User.class);}});
config.setExcludes(new String[]{"password"});//數組,過濾多個不須要轉化的屬性

    返回:
    JSONSerializer.toJSON(user,config).toString();//
相關文章
相關標籤/搜索