Skip to content

[Jackson] API 응답 데이터 중 일부만 저장하기 #2

Description

@dkdud9261

외부 API를 연동할 때, 응답 데이터를 코틀린 객체로 직렬화 하는 과정에서 응답으로 오는 필드 중 일부만 매핑하고 싶을 때가 있다.

이 경우 그냥 원하는 필드만 DTO 클래스에 정의하게 되면 아래와 같은 예외가 발생한다.

Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "필드명"

대신 DTO 클래스에 @JsonIgnoreProperties(ignoreUnknown=true) 를 붙이면 해결~!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions