JsonConfig config = new JsonConfig();
config.setJsonPropertyFilter(new PropertyFilter() {
public boolean apply(Object source, String name, Object value) {
if (name.equals("form") || name.equals("formElm") ) {
return true;
} else {
return false;
}
}
});
JSONObject jsonObject = JSONObject.fromObject( form, config );
config.setJsonPropertyFilter(new PropertyFilter() {
public boolean apply(Object source, String name, Object value) {
if (name.equals("form") || name.equals("formElm") ) {
return true;
} else {
return false;
}
}
});
JSONObject jsonObject = JSONObject.fromObject( form, config );
本文介绍了一种使用Java实现的JSON配置方法,并通过自定义属性过滤器来控制JSON对象的生成过程。具体展示了如何设置JSON配置以仅包含特定字段,如form和formElm。
1839

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



