I have data received from DB in JSON format, but I have to align all the fields in a proper position like below:
{
"Name":"Maveric",
"Age":"26",
"Add":"22 Boston Street"
}
I have tried this below and to assign the response fields in proper position.
@JsonPropertyOrder({"Name","Age","Add"})
but it's not working as expected. Every time, fields are getting different positions.
i got my solution sorry for posting late. here below is the JSON annotation for some solution.
`@JsonInclude(JsonInclude.Include.NON_NULL)` ignore Null fields
`@JsonProperty("maximum")` Map next Api JSON Data(MaximuM) value to you Java bean object (max)
private String max;
private String date;
@JsonProperty(index=1) Return json response date feild on 1 index/position
public String getDate() {
return date;
}
public void setDate(String string) {
date = string;
}