JsonConfig cfg = new JsonConfig(); cfg.setPropertySetStrategy(new PropertySetStrategy() { @Override public void setProperty(Object bean, String key, Object value) throws JSONException { try { PropertyUtils.setNestedProperty(bean, key, value); } catch (Exception e) { e.printStackTrace(); } } }); cfg.setRootClass(TweetView.class); TweetView tv = (TweetView) JSONObject.toBean(jo, cfg);
json转换成对像过滤掉无用的属性
本文介绍了一种使用Java实现的将JSON字符串转换为特定Java对象的方法,并通过自定义配置过滤掉不需要的属性。
1463

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



