List<Node> list = d3Util.parseTaskDTO2Nodes(nodeList);
JsonConfig config = new JsonConfig();
config.registerJsonValueProcessor(State.class,
new JsonValueProcessor() {
@Override
public Object processArrayValue(Object value,
JsonConfig _config) {
if (value instanceof State)
return ((State) value).getValue();
else
return value;
}
@Override
public Object processObjectValue(String key,
Object value, JsonConfig _config) {
if (value instanceof State)
return ((State) value).getValue();
else
return value;
}
});
JSONArray jArray = JSONArray.fromObject(list, config);
json valueProcessor test
最新推荐文章于 2024-07-21 21:11:33 发布