두 손끝의 창조자

jackson ObjectMapper 에서 옵션 설정하기 본문

프로그래밍언어/Java

jackson ObjectMapper 에서 옵션 설정하기

codinglog 2022. 4. 20. 17:07
ObjectMapper objectMapper = new ObjectMapper();
//noinspection deprecation
objectMapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true);
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

 

위 코드는 오브젝트를 컨버팅 할 때 타깃과 소스의 이름의 케이스를 무시하고 없는 경우도 오류내지 않고 가능한 것만 매핑하라는 옵션이다.

 

반응형
Comments