SpringBoot23 com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `java.lang.String` from Array value (token `JsonToken.START_ARRAY`) 배경 카카오 책검색 API 응답 도중 아래와 같은 에러가 발생했다. 더보기 com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `java.lang.String` from Array value (token `JsonToken.START_ARRAY`) - 카카오 API를 통해 아래와 같은 구조의 json 응답 { "documents": [ { "authors": [ "이보영" ], "contents": "content1", "title": "뜯어먹는 중학 영숙어 1000(스프링)(스프링)" }, { "authors": [ "정혜련", "진효정" ], "contents": "content3" ".. 2023. 1. 3. com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "필드명" 원인? JSON데이터를 DTO객체로 매핑 시 선언되지 않은 필드가 존재할 경우 아래와 같은 에러가 발생한다. (=JSON내 특정 프로퍼티 존재하나 DTO객체 내 해당 필드가 선언되지 않은 경우) 더보기 com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "logo" 예시 특정 API 응답으로 JSON 데이터에 resultCode, resultMessage 프로퍼티가 있다고 가정한다. { resultCode : "0", resultMessage : "success" } 그런데 ObjectMapper 사용하여 응답받은 JSON데이터를 내가 정의한 DTO클래스로 매핑 시 아래와 같이 resultMessage 필.. 2023. 1. 3. Lombok 어노테이션 Lombok어노테이션 중 자주 사용하는 어노테이션들 정리해보겠습니다. 생성자 자동 생성 생성자를 자동 생성해주이 가능한 어노테이션들이다. @NoArgsConstructor - 파라미터 없는 생성자 생성 @ = NoArgsConstructor @Getter @Setter public class BookSearchedEntity { String Title; String Author; String PubDate; String Description; String Publisher; /* 생략 가능 @NoArgsConstructor public BooksearchedEntity(){} */ } @AllArgsConstructor - 모든 필드값으로 생성자 생성 @AllArgsConstructor @Getter @.. 2022. 12. 6. 이전 1 ··· 3 4 5 6 다음