One field in the json passed to me is different from the field name of the Java object that I want to deserialize this json into. Suppose I want to deserialize:
{"bag": "LV"}
into
Class MyClass {
String backpack;
}
So the field backpack
should have value LV
after deserialization.
The issue is MyClass
is from a library that I cannot change or add annotations. Nor do I have any control over the json passed to me. I wonder how I can configure Gson to do it. All the other fields match perfectly.