Issue
I am new to Spring-MVC.
I am sending data to my view as JSON, and there I am deserializing it to a string, but I want to pass only selected fields, I don't want all fields to send there but how to ignore selected fields I don't know.
public class account{
private Integer userId;
private String userName;
private String emailId;
//getter - setter
}
In some activity I don't want some fields so I want to avoid that fields so any idea on this confusing situation ?
Solution
Add the annotation @JsonIgnoreProperties("fieldname")
to your POJO
.
or you can use @JsonIgnore
also before field name that you want to ignore while deserializing JSON.
example :
@JsonIgnore
@JsonProperty(value = "user_password")
public java.lang.String getUserPassword()
{
return userPassword;
}
Here Is my Answer for Similar Question.
Answered By - user3145373 ツ
Answer Checked By - Robin (JavaFixing Admin)