-
Notifications
You must be signed in to change notification settings - Fork 496
New issue
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
[BUG] Deserialization includes additional @type information after WriteClassName #2581
Comments
WriteClassName在parse时应该和SupportAutoType配对使用,这个不是BUG |
public void test() {
HashMap<String, String> map = new HashMap<>();
map.put("date", "2022");
String jsonString = JSON.toJSONString(map, JSONWriter.Feature.WriteClassName);
HashMap result = JSON.parseObject(jsonString, HashMap.class, JSONReader.Feature.SupportAutoType);
System.out.println(JSON.toJSONString(result));
// {"date":"2022","@type":"java.util.HashMap"}
assertEquals(1, result.size());
} 是配对使用的,但在parse后的map entry里面依然保留着类型信息 |
wenshao
added a commit
that referenced
this issue
May 17, 2024
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.51-SNAPSHOT/ |
验证已修复,辛苦温少 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
问题描述
Map序列化配置WriteClassName后,反序列化会多出类型信息的entry(配置SupportAutoType也是),在fastjson 1.2.83上没有这个问题
环境信息
重现步骤
期待的正确结果
不含有
@type -> java.util.HashMap
项The text was updated successfully, but these errors were encountered: