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:

 My Attempt to learn AI  GPT Generative Pretrained Transformer Created by Google in 2017 with the publication of the paper "Attention ...

Popular in last 30 days