Make JSON payload fields case insensitive when mapping to Java Object in REST API developed using SpringBoot

后端 未结 2 1728
自闭症患者
自闭症患者 2020-12-15 10:07

I am working on REST API developed using SpringBoot application. Here I want to make the fields in the payload(JSON) as case insensitive when mapping to a Java Object. Below

2条回答
  •  悲&欢浪女
    2020-12-15 10:45

    Well, if its Spring Boot application you can have this in your application.properties file: spring.jackson.mapper.accept_case_insensitive_properties=true

    or if you use yaml:

    spring:
      jackson:
        mapper:
          accept_case_insensitive_properties: true
    

提交回复
热议问题