I need to create a bean for this json object.
{ "user_name" : "my-name" }
My java class is like this.
public class User {
String username;
}
Is there any annotation to map username
to user_name
without changing the field name to user_name
? Something like @JsonProperty(name="user_name")
?
You should use the @SerializedName("user_name")
annotation provided by gson instead.