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
[{"array":["test1", "test2", "test3"]}]序列化为Java对象,再反序列化为Json,就变成了[{"array":["test1","test2","test3","test1","test2","test3"]}]。元素数量变成双倍。
test()
public class JsonTest { static class ListTest { public final List<String> array; public ListTest(List<String> array) { this.array = array; } } @Test public void test() { String json = "[{\"array\":[\"test1\", \"test2\", \"test3\"]}]"; List<ListTest> values = JSONObject.parseObject(json, TypeReference.collectionType(List.class, ListTest.class)); System.out.println(JSONObject.toJSONString(values)); // [{"array":["test1","test2","test3","test1","test2","test3"]}] } }
[{"array":["test1", "test2", "test3"]}]
当前输出:[{"array":["test1","test2","test3","test1","test2","test3"]}]
见代码。
The text was updated successfully, but these errors were encountered:
fix final field initialized in the constructor set twice for issue al…
c1a5195
…ibaba#1873
fix final field initialized in the constructor set twice for issue #1873
0796a9b
https://github.com/alibaba/fastjson2/releases/tag/2.0.41 问题已修复,请用新版本
Sorry, something went wrong.
No branches or pull requests
问题描述
[{"array":["test1", "test2", "test3"]}]序列化为Java对象,再反序列化为Json,就变成了[{"array":["test1","test2","test3","test1","test2","test3"]}]。元素数量变成双倍。
环境信息
重现步骤
test()
方法期待的正确结果
[{"array":["test1", "test2", "test3"]}]
相关日志输出
当前输出:[{"array":["test1","test2","test3","test1","test2","test3"]}]
附加信息
见代码。
The text was updated successfully, but these errors were encountered: