프로그래밍/ErrorLog

com.fasterxml.jackson.databind.exc.mismatchedinputexceptin cannot deserialize instance of java.util.arraylist java.lang.object out of value_string token

미냐님 2023. 1. 5. 18:35
728x90

json 역직렬화

com.fasterxml.jackson.databind.exc.mismatchedinputexception cannot deserialize instance of java.util.arraylist java.lang.object out of value_string token

 

API로 요청된 json 데이터를 객체에 파싱 하는 과정에서 발생하였다.

 

해당 객체 클래스에 @JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY) 을 추가해주거나


ObjectMapper 를 사용중이라면

ObjectMapper objectMaaper = new ObjectMapper();
objectMaaper.configure(DeserializationFeature.ACCEPT_SINGLE_ALUE_AS_ARRAY, true)

 

이런 형식으로사용해주면 된다

 

 

 

 

 

 

728x90