i\'m working with the youtube json from google-api-client :
{
\"apiVersion\": \"2.0\",
\"data\": {
\"updated\": \"2011-01-05T13:48:33.146Z\",
I believe your answer lies in the JSON Field Naming Support:
Gson supports some pre-defined field naming policies to convert the standard Java field names (i.e. camel cased names starting with lower case --- "sampleFieldNameInJava") to a Json field name (i.e. sample_field_name_in_java or SampleFieldNameInJava).
See for instance the following example:
private class SomeObject {
@SerializedName("custom_naming") private final String someField;
private final String someOtherField;
public SomeObject(String a, String b) {
this.someField = a;
this.someOtherField = b;
}
}
So you should be able to define the field mapping to the default value like this:
@SerializedName("default")
private final String someOtherNameThanDefault;