Skip to content

@JsonUnwrapped fields are skipped when using PropertyBasedCreator if they appear after the last creator property #2088

@sixbangs

Description

@sixbangs

Example:

    static class Bean {
        int x;
        int y;

        @JsonUnwrapped
        UnwrappedBean w;

        public Bean(@JsonProperty("x") int x, @JsonProperty("y") int y) {
            this.x = x;
            this.y = y;
        }

        public void setW(UnwrappedBean w) {
            this.w = w;
        }
    }

    static class UnwrappedBean {
        int a;
        int b;

        public UnwrappedBean(@JsonProperty("a") int a, @JsonProperty("b") int b) {
            this.a = a;
            this.b = b;
        }
    }
    {"x": 1, "a": 2, "y": 3, "b": 4}

x, y, and a are deserialized as expected. b is skipped entirely. I think I've found the root cause and the fix doesn't appear to break any tests; opening a PR for further review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions