@Autowired
private ObjectMapper mapper;
mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true);
// deprecated mapper.setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES);
mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
jackson的ObjectMapper忽略大小写与驼峰命名
最新推荐文章于 2025-10-22 09:00:00 发布
本文介绍如何使用@Autowired注解初始化Jackson的ObjectMapper,并配置其接受大小写不敏感的属性名称,以及设置属性命名策略为snake_case。
2475

被折叠的 条评论
为什么被折叠?



