I have a POJO class A and I want the fields to be in the order I defined, but '1800number' appears last in the response since it starts with a number. How do I avoid that?
@JsonInclude(JsonInclude.Include.NON_NULL)
public class A {
private String name;
private String age;
private String dept;
@JsonProperty("1800number")
private String _1800number;
private String email;
}
This is how I get the response
{
"name": "Mark",
"age": "52",
"dept": "Civil",
"email": "mark@gmail",
"1800number": "12345"
}
I use below libraries In my gradle
compile('com.fasterxml.jackson.core:jackson-annotations:2.8.3')
compile('com.fasterxml.jackson.core:jackson-databind:2.8.3')