본문 바로가기

스터디

spring boot에서 restTemplate 호출시 응답값을 deserialize 하는 과정에 오류 해결.

spring boot에서 restTemplate 호출시 응답값을 deserialize 하는 과정에 오류 해결.

 

오류 : Cannot deserialize instance of object out of START_ARRAY token

 

 

data class XxxRes(
  var code: Int = -1,
  var message: String = "",
  @JsonFormat(with = [JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY])
  var info: List<XxxItemRes>? = null
)

data class XxxItemRes(
  var type: String? = null,
  ...
)




 

cnpnote.tistory.com/entry/SPRING-%EC%A3%BC%EC%84%9D%EC%9D%84-%EC%82%AC%EC%9A%A9%ED%95%98%EC%97%AC-jackson%EC%9D%98-%EB%B9%84-%EC%A7%81%EB%A0%AC%ED%99%94-%ED%94%84%EB%A1%9C%EC%84%B8%EC%8A%A4%EC%97%90%EC%84%9C-ACCEPTSINGLEVALUEASARRAY%EB%A5%BC-%EC%A0%81%EC%9A%A9%ED%95%98%EB%8A%94-%EB%B0%A9%EB%B2%95