I have a class like this:
class A {
@Expose
@SerializedName("a_id")
private String id;
}
Now I want to create class B that extends A, but, in B, I want to change the SerializedName of id to "b_id". Is there a way to do this?
It isn't possible out of the box. You'll need to write a custom type adapter. See the Custom Serialization and Deserialization section of the Gson user's guide.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With