In my Java class I have a field declared like this:
protected double a = 0.0;
In the JSON that is deserialized to reconstitute this class, that field can appear with either of two different names (legacy issue). As an example, the JSON field can look like this:
"a": 9.57,
or like this:
"d": 9.57,
(Luckily, the legacy name "d" does not cause a naming collision with any other variables.)
My problem is that I need to populate the class field "a" with either the JSON key "a" or "d" -- whichever is present. (I believe they are always mutually exclusive, but I have not actually proven that beyond all doubt.)
I'm using Gson 2.2.1 and Java 7 in Netbeans.