Skip to content
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

数据类型为List<Hashtable<String, String>>解析json串结果为空对象 #1707

Closed
lukeit opened this issue Aug 2, 2023 · 2 comments
Closed
Labels
bug Something isn't working fixed
Milestone

Comments

@lukeit
Copy link

lukeit commented Aug 2, 2023

问题描述

fastjson2版本下,数据类型为List<Hashtable<String, String>>解析json串结果为空对象,换成List<HashMap<String, String>>就没有问题,同样的json串在fastjson下解析没有问题。

环境信息

请填写以下信息:

  • OS信息: [e.g.:Windows 10 4Core 3.20GHz 16 GB]
  • JDK信息: [e.g.:Openjdk 17.0.7]
  • 版本信息:[e.g.:Fastjson2 2.0.34+]

重现步骤

模型:
public class DictionaryModule implements Serializable {
private static final long serialVersionUID = -1L;
private String dictKey;
private String tableName;
private Hashtable<String, String> queryColumns;
private Hashtable<String, List<HashMap<String, Object>>> params;
private List<Hashtable<String, String>> orders;
...
}
json串:
'{"dictKey":"sys_post","tableName":"sys_post",' +
'"queryColumns":{"code":"post_id","sort":"post_sort","label":"post_name","value":"post_id"},' +
'"params":{"orCondition":[{"column":"status","operator":"<>","value":1},{"column":"status","operator":"is","value":null}]},' +
'"orders":[{"column":"post_sort","sequences":"asc"},{"column":"create_time","sequences":"desc"}]}'
解析结果:orders属性只有两个空对象,其它属性没有问题;orders类型换成List<HashMap<String, String>>就没有问题,同样的json串在fastjson下解析没有问题。

@lukeit lukeit added the bug Something isn't working label Aug 2, 2023
kraity added a commit to kraity/fastjson2 that referenced this issue Aug 6, 2023
Signed-off-by: Kraity <kraty@krait.cn>
wenshao pushed a commit that referenced this issue Aug 6, 2023
Signed-off-by: Kraity <kraty@krait.cn>
@wenshao
Copy link
Member

wenshao commented Aug 13, 2023

https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.39-SNAPSHOT/
问题已修复,请帮忙用2.0.39-SNAPSHOT版本验证,2.0.39版本预计在8月27日前发布

@wenshao wenshao added this to the 2.0.39 milestone Aug 13, 2023
@wenshao wenshao added the fixed label Aug 13, 2023
@wenshao
Copy link
Member

wenshao commented Aug 15, 2023

@wenshao wenshao closed this as completed Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed
Projects
None yet
Development

No branches or pull requests

2 participants