내 성장기록
json 역직렬화
koyuchang
2021. 2. 7. 15:34
이슈
프론트에서(Vue) String형의 리스트를 보내주면
"JSON parse error : Cannot deserialize instance of 'java.util.ArrayList' out of VALUE_STRING token; nexted exception is com.fasterxml.jackson.databind.exc.MismatchedInputException" 이 발생한다.
해결
해당 리스트 변수가 포함된 클래스에 @JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY) 을 추가해주면된다.
출처
https://stackoverflow.com/questions/39041496/how-to-enforce-accept-single-value-as-array-in-jacksons-deserialization-process