Creating Java Object with reserved keywords as variable name for json

Creating Java Object with reserved keywords as variable name for Json


If you use GSON for parsing you can name your members as you want and annotate them for mapping.
@SerializedName("class")
private String classCode;
Another option you've got is to use Jackson, and use the @JsonProperty annotation..
@JsonProperty("class")
private String classCode;

Hope this helps :)

No comments:

 Python Basics How to check the version of Python interpreter mac terminal

Popular in last 30 days