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

[BUG]fastjson1和2同版本结果不一致(兼容问题) #1203

Closed
w-sf opened this issue Mar 8, 2023 · 2 comments
Closed

[BUG]fastjson1和2同版本结果不一致(兼容问题) #1203

w-sf opened this issue Mar 8, 2023 · 2 comments
Labels
bug Something isn't working fixed
Milestone

Comments

@w-sf
Copy link

w-sf commented Mar 8, 2023

问题描述

使用snakeyaml.loadAs方法解析出的json,1版本可以操作,2版本不行

环境信息

  • OS信息: [Windows10家庭中文版22H2-19045.2673]
  • JDK信息: [1.8.0_291]
  • 版本信息:[2.0.24]
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>2.0</version>

重现步骤

  1. 使用 snakeyaml.loadAs 方法
  2. 操作解析后的json
  3. 1版本可以操作,结果(a,b);2版本不行,结果只有(a)
JSONArray array = new JSONArray();
array.add("a");
JSONObject object = new JSONObject();
object.put("array", array);
Yaml yaml = new Yaml();
JSONObject json = yaml.loadAs(new StringReader(object.toString()), JSONObject.class);
JSONArray res = json.getJSONArray("array");
res.add("b");
System.out.println(json.getJSONArray("array"));

期待的正确结果

2版本也可以操作(兼容1版本)

@w-sf w-sf added the bug Something isn't working label Mar 8, 2023
@wenshao
Copy link
Member

wenshao commented Mar 8, 2023

https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.25-SNAPSHOT/
问题已修复,请帮忙用2.0.25-SNAPSHOT版本验证,2.0.25版本预计在3月中旬发布。

@wenshao wenshao added this to the 2.0.25 milestone Mar 8, 2023
@wenshao wenshao added the fixed label Mar 8, 2023
@w-sf
Copy link
Author

w-sf commented Mar 9, 2023

可以了,感谢

@w-sf w-sf closed this as completed Mar 9, 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