error

[에러해결] Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value

!쪼렙조햄 2021. 12. 6. 12:15
반응형

spring boot 에서 jackson object mapper로, 
받아온 API 의 응답을 파싱할때 생긴 오류

해결 방법

나는 기존에 jackson objectMapper 을 한개 생성해서 사용중이었음

@Configuration
class ObjectMapperConfiguration {

    @Bean
    fun objectMapper(): ObjectMapper {
        val mapper = ObjectMapper()
        mapper.registerModules(JavaTimeModule(), KotlinModule())
        mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
        // 요 아랫 줄을 추가했다!
        mapper.configure(JsonReadFeature.ALLOW_UNESCAPED_CONTROL_CHARS.mappedFeature(), true)
        return mapper
    }
}

 

데헷

그러나 위의 해결방법은 다시 원복되었다
이유는 나의 json파일 자체가 깨져 있었기 때문이었다.

원인 파악을 위한 구글링 중에 많은 사람들이
"너의 json 파일을 확인해봐아..!!" 라고 했지만
듣지 않았던 나자신.. 반성..

반응형