Webclient + Jackson:如何设置反序列化以将snake_case转换为camelCase?

问题描述 投票:0回答:1

我想避免必须在属性前面加上@JsonProperty("property_name"),而只需设置Spring WebClient构建器即可将所有snake_cases转换为camelCases。

有可能吗?

java jackson spring-webclient
1个回答
0
投票

您可以在模型类中添加注释:

@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
public class Model {
  String camelCase; //will be camel_case in json
}
© www.soinside.com 2019 - 2024. All rights reserved.