I have the following class:
public class Message { private String text; public String getText() { return text; } public void setText(St
If using spring, then in application.properties file add following:-
application.properties
spring.jackson.serialization.WRAP_ROOT_VALUE=true
And then use @JsonRootName annotation on any of your class that you wish to serialize. e.g.
@JsonRootName
@JsonRootName("user") public class User { private String name; private Integer age; }