jackson-future-ideas icon indicating copy to clipboard operation
jackson-future-ideas copied to clipboard

Rename a @JsonProperty only inside a @JsonView

Open membersound opened this issue 6 years ago • 0 comments

It would be handy if one could rename a json property only inside a specific view.

public class PersonDTO {
    @JsonView(View.Specific.class)
    private String personname;

    static class View {
          interface Specific {
               //@JsonProperty("firstname") //TODO this does not work
               private String personname;
          }
    }
}

Here, default field name is "personname", but when using the view explicit, the field should only then be renamed to "firstname".

membersound avatar Mar 08 '18 15:03 membersound