4

I want to rename a json field, but only within a specific @JsonView.

Is that possible at all?

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;
          }
    }
}

If the view is not used, the fields name should just remain "personname".

membersound
  • 81,582
  • 193
  • 585
  • 1,120

0 Answers0