Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

@JSONField不起作用 #638

Closed
itlihuaxin opened this issue Aug 6, 2022 · 1 comment
Closed

@JSONField不起作用 #638

itlihuaxin opened this issue Aug 6, 2022 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@itlihuaxin
Copy link

itlihuaxin commented Aug 6, 2022

  • 版本信息:[2.0.10]
@Getter
@Setter
public class Clothing {
   @JSONField(name = "tShirtType")
   private List<String> tShirtType;
   
   public static void main(String[] args) {
   	Clothing clothing = new Clothing();
   	if (clothing.getTShirtType() == null) {
   		clothing.setTShirtType(new ArrayList<>());
   	}
   	clothing.getTShirtType().add("Sweater Vest");
   	
   	System.out.println(JSON.toJSONString(clothing));
   }
}

打印的是
{"TShirtType":["Sweater Vest"]}
还是TShirtType

fastjson 1没问题

@itlihuaxin itlihuaxin added the bug Something isn't working label Aug 6, 2022
@wenshao wenshao added this to the 2.0.11 milestone Aug 6, 2022
@wenshao
Copy link
Member

wenshao commented Aug 7, 2022

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

@wenshao wenshao closed this as completed Aug 7, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants