In my Java class, I have a field declared as follows:
protected double a = 0.0;
In JSON, which is deserialized to recreate this class, this field can be displayed with either of two different names (obsolete problem). For example, a JSON field might look like this:
"a": 9.57,
or like this:
"d": 9.57,
(Fortunately, the deprecated name "d" does not cause names to collide with any other variables.)
My problem is that I need to fill in the class "a" field with either the JSON key "a" or "d" - depending on what is present. (I believe that they are always mutually exclusive, but in fact I have not proved this, without a doubt.)
I am using Gson 2.2.1 and Java 7 in Netbeans.