I have this result from server:
{"product_option_values":[{"id":43}, {"id":45}]}
And, I Have these classes to parse the above string for the class below
public class MyClass {
@Key("product_option_values")
private List<ProductOptionValueResult> values;
public List<ProductOptionValueResult> getValues() {
return values;
}
public void setValues(List<ProductOptionValueResult> values) {
this.values = values;
}
}
public class ProductOptionValueResult {
private Integer id;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
}
I'm trying to convert the string above to an instance of MyClass like this:
MyClass myclass = gson.fromJson(stringAbove, MyClass.class);
However I get null in the object's values property, why?
@Key- what library is it from?GSONtoo. packagecom.google.api.client.util