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]JSONObject中放入null值后,toJSONString输出异常 #828

Closed
dfengwei opened this issue Oct 11, 2022 · 2 comments
Closed

[BUG]JSONObject中放入null值后,toJSONString输出异常 #828

dfengwei opened this issue Oct 11, 2022 · 2 comments
Labels
bug Something isn't working fixed
Milestone

Comments

@dfengwei
Copy link

dfengwei commented Oct 11, 2022

问题描述

2.0.15版本,当往一个JSONObject中放入值为null的属性后,toJSONString输出异常。2.0.14版本无此问题。

环境信息

  • OS信息: WIndows11
  • JDK信息: Openjdk 11
  • 版本信息:Fastjson2 2.0.15

重现步骤

1.执行以下代码:

JSONObject test = new JSONObject();
test.put("a", "a value");
test.put("b", null);
test.put("c", "c value");
System.out.println(test.toJSONString());

2.输出:

{"a":"a value",,"c":"c value"}

期待的正确结果

{"a":"a value","c":"c value"}
@dfengwei dfengwei added the bug Something isn't working label Oct 11, 2022
yanrongzhen added a commit to yanrongzhen/fastjson2 that referenced this issue Oct 12, 2022
wenshao pushed a commit that referenced this issue Oct 12, 2022
@wenshao wenshao added this to the 2.0.16 milestone Oct 13, 2022
@wenshao wenshao added the fixed label Oct 13, 2022
@wenshao
Copy link
Member

wenshao commented Oct 13, 2022

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

@wenshao
Copy link
Member

wenshao commented Oct 22, 2022

https://github.com/alibaba/fastjson2/releases/tag/2.0.16
问题已修复,请用2.0.16版本

@wenshao wenshao closed this as completed Oct 22, 2022
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