Inconsistent json field name issue

1. Scene

       Project development process, sometimes a third party may be docking platform, might exist field names are not the same problems, and inconsistent field names of the parties, and the code has been in development for some time Le, because if the field name is not the same problem The two sides agreed to change the attribute name, so change is too big, no insurance, Here I took it for such a scenario, if resolved.

Assumptions: http docking systems, transmission is json. There is a parameter "name"

Third-party platform: name

Development Environment: userName

Directly through the entity class mapping, needless to say definitely a problem

2. Solution

	@JsonProperty("name")
	private String userName;

Add a comment on the properties of the entity class can solve this problem.

 

如果你热衷技术,喜欢交流,欢迎加入我们! 

Guess you like

Origin blog.csdn.net/qq_16855077/article/details/93205103