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
给list的字段添加了@JSONField(serializeUsing=FieldWriteTest.class) FieldWriteTest 对象创建了,但是并不会回调write 方法.
请填写以下信息:
import java.lang.reflect.Type; import java.util.List; import org.junit.Test; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONWriter; import com.alibaba.fastjson2.annotation.JSONField; import com.alibaba.fastjson2.writer.ObjectWriter; import com.google.common.collect.Lists; public class JSONSerializeUsingTest { @Test public void test() { A a = new A(); a.list = Lists.newLinkedList(); a.list.add("test 1"); a.list.add("test 2"); String str = JSON.toJSONString(a); System.out.print(str); } public static class A{ @JSONField(serializeUsing=FieldWriteTest.class) public List<String> list; } public static class FieldWriteTest implements ObjectWriter<List<String>>{ @Override public void write(JSONWriter jsonWriter, Object object, Object fieldName, Type fieldType, long features) { System.out.print("in write!"); } } }
看不到输出“in write!"
The text was updated successfully, but these errors were encountered:
fix support custom ObjectWriter on List for issue alibaba#1948
a921431
fix support custom ObjectWriter on List for issue #1948
86f0d31
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson/2.0.42-SNAPSHOT/ 问题已修复,请帮忙用2.0.42-SNAPSHOT版本验证,正式版本预计在下个周末(11月5日)发布。
Sorry, something went wrong.
https://github.com/alibaba/fastjson2/releases/tag/2.0.42 问题已修复,请用新版本
yanxutao89
No branches or pull requests
问题描述
给list的字段添加了@JSONField(serializeUsing=FieldWriteTest.class)
FieldWriteTest 对象创建了,但是并不会回调write 方法.
环境信息
请填写以下信息:
看不到输出“in write!"
The text was updated successfully, but these errors were encountered: