I\'m using SpringMVC and have the following Method.
@RequestMapping(\"/login\") public @ResponseBody User login(User user) { // some operation here ....
Spring uses Jackson to serialize and deserialize JSON by default. You can use Jackson's @JsonSerialize annotation on your User type and provider a JsonSerializer implementation which performs the serialization as you want it.
@JsonSerialize
User
JsonSerializer