We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
项目升级了fastjson2.0.19,配置多个ValueFilter的实现类,目前只会生效最后一个加入的,升级到2.0.23也是有同样的问题。 翻看源码发现JSONWriter.Context.configFilter中后一个ValueFilter的实现类会覆盖前一个。是否是ValueFilter的生效机制出现了变化,如何像fastjson1一样让所有的ValueFilter都生效呢?请大佬帮忙解答一下,多谢!
public class Test{ public static class TestValueFilter1 implements ValueFilter{ @Override public Object apply(Object o, String s, Object o1){ System.out.println("print test1 value filter"); return o1; } } public static class TestValueFilter2 implements ValueFilter{ @Override public Object apply(Object o, String s, Object o1){ System.out.println("print test2 value filter"); return o1; } } public static void main(String[] args){ Map<String, String> map = new HashMap<>(); map.put("a", "b"); ValueFilter[] filters = new ValueFilter[]{new TestValueFilter1(), new TestValueFilter2()}; System.out.println(JSON.toJSONString(map, filters, JSONWriter.Feature.WriteMapNullValue)); } }
print test1 value filter print test2 value filter {"a":"b"}
print test2 value filter {"a":"b"}
The text was updated successfully, but these errors were encountered:
bug fix for multi ValueFilter, for issue #1078
8bab508
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.24-SNAPSHOT/ 问题已修复,请用2.0.24-SNAPSHOT版本帮忙验证,2.0.24-SNAPSHOT预计在2月中旬发布。在此之前,你也可以用ValueFilter#compose方法组合两个ValueFilter。
Sorry, something went wrong.
https://github.com/alibaba/fastjson2/releases/tag/2.0.24 问题已修复,请用新版本
No branches or pull requests
问题描述
项目升级了fastjson2.0.19,配置多个ValueFilter的实现类,目前只会生效最后一个加入的,升级到2.0.23也是有同样的问题。
翻看源码发现JSONWriter.Context.configFilter中后一个ValueFilter的实现类会覆盖前一个。是否是ValueFilter的生效机制出现了变化,如何像fastjson1一样让所有的ValueFilter都生效呢?请大佬帮忙解答一下,多谢!
环境信息
期待的正确结果
print test1 value filter
print test2 value filter
{"a":"b"}
实际日志输出
print test2 value filter
{"a":"b"}
The text was updated successfully, but these errors were encountered: