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
当json object中同名的key有三个时,使用DuplicateKeyValueAsArray后,实际得到的value只有一个,而不是一个数组
String str = "{"a":2,"b":1,"b":2,"b":3}"; JSONObject jsonObject = JSON.parseObject(str, JSONReader.Feature.DuplicateKeyValueAsArray); String b = jsonObject.get("b").toString();
输出结果为: 3
[1,2,3]
com.alibaba.fastjson2.JSONReader#readObject(java.lang.Object, long)
2.0.21 版本 com.alibaba.fastjson2.JSONReader这个类的1556行,value应替换为origin
The text was updated successfully, but these errors were encountered:
fix DuplicateKeyValueAsArray, for issue #1100
1874faf
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.24-SNAPSHOT/ 问题已修复,请用2.0.24-SNAPSHOT版本帮忙验证,2.0.24-SNAPSHOT预计在2月中旬发布。
Sorry, something went wrong.
验证ok
No branches or pull requests
问题描述
当json object中同名的key有三个时,使用DuplicateKeyValueAsArray后,实际得到的value只有一个,而不是一个数组
环境信息
重现步骤
String str = "{"a":2,"b":1,"b":2,"b":3}";
JSONObject jsonObject = JSON.parseObject(str, JSONReader.Feature.DuplicateKeyValueAsArray);
String b = jsonObject.get("b").toString();
输出结果为: 3
期待的正确结果
[1,2,3]
附加信息
com.alibaba.fastjson2.JSONReader#readObject(java.lang.Object, long)
2.0.21 版本 com.alibaba.fastjson2.JSONReader这个类的1556行,value应替换为origin
The text was updated successfully, but these errors were encountered: