@Controller @Results({ @Result(name="json",type="json" , params={"root","outDataMap","excludeNullProperties","true" ,"excludeProperties","^ret\\[\\d+\\]\\.city\\.province,^ret\\[\\d+\\]\\.enterprise\\.userinfos","enableGZIP","true" }) }) public class UserinfoAction extends BaseAction { @Action(value="login") public String login(){ if(jsonQueryParam!=null && jsonQueryParam.length()>0) { user = JsonMapper.fromJson(jsonQueryParam, TUserinfo.class); } Assert.notNull(user);
before setting the excludeProperties property, the result will be lower:
{"ret":[ { "city":{"cityename":"tianjin","cityid":"12","cityname":"天津" ,"province": {"provinceename":"tianjing","provinceid":"02","provincename":"天津"} } ,"createddate":"2014-01-07T11:13:58" ,"enterprise":{"createddate":"2014-01-07T08:38:00","enterpriseid":"402880a5436a227501436a2277140000","enterprisename":"测试企业2","enterprisestate":0 ,"userinfos":[null,{"city":{"cityename":"beijing","cityid":"11","cityname":"北京","province":{"provinceename":"beijing","provinceid":"01","provincename":"北京市"} },"comments":"ceshi","createddate":"2004-05-07T21:23:44","enterprise":null,"lastlogindate":"2014-01-08T08:50:34","logincount":11,"telphone":"2","userid":"402880a5436a215101436a2156e10000","username":"0.5833032879881197","userpwd":"12","userstate":1,"usertype":0}] } ,"lastlogindate":"2014-01-08T10:32:43","logincount":0,"telphone":"2","userid":"402880a5436ab13701436ab1b74a0000","username":"testUser","userpwd":"333","userstate":1,"usertype":0}] }
after setting the excludeProperties property, there are no provincial nodes and userinfos, the result is below:
{"ret": [{ "city":{"cityename":"tianjin","cityid":"12","cityname":"天津"} ,"createddate":"2014-01-07T11:13:58" ,"enterprise":{"createddate":"2014-01-07T08:38:00","enterpriseid":"402880a5436a227501436a2277140000","enterprisename":"测试企业2","enterprisestate":0} ,"lastlogindate":"2014-01-08T11:05:32","logincount":0,"telphone":"2","userid":"402880a5436ab13701436ab1b74a0000","username":"testUser","userpwd":"333","userstate":1,"usertype":0 }] }