Q:

Custom type in GreenDao with POJO class

This is my sample JSON:  
{  
   "open":true,
   "total_products":100,
   "product":[  
      {  
         "p_id":1,
         "price":"5.00",
         "name":"blah one"
      },
      {  
         "p_id":2,
         "price":"15.00",
         "name":"blah two"
      },
...
    ]
}

This is my POJO class:
@Entity(nameInDb = "products")
public class ProductsPOJO {

    @SerializedName("open")
    @Property(nameInDb = "open")
    private boolean open;

    @SerializedName("total_products")
    @Property(nameInDb = "total_products")
    private Long total_products;

    @Convert(converter = ProductConverter.class, columnType = String.class)
    @SerializedName("product")
    @Property(nameInDb = "product")
    private Product product;

    public static class productConverter implements PropertyConverter<Product, String> {
        //What shoudl I write in convert part?!
        @Override
        public Product convertToEntityProperty(String databaseValue) {
            if (databaseValue == null) {
                return null;
            }
            for (Product p : Product.values()) {
                if (p.id == databaseValue) {
                    return p;
                }
            }
            return Product.DEFAULT;
        }

        @Override
        public String convertToDatabaseValue(Product entityProperty) {
            return entityProperty == null ? null : entityProperty.;
        }
        //
        /*@Override
        public Product convertToEntityProperty(String databaseValue) {
        return Product.valueOf(databaseValue);
        }

        @Override
        public String convertToDatabaseValue(Product entityProperty) {
        return entityProperty.name();
        }*/
    }

    public static class Product{
        @Id
        @SerializedName("p_id")
        private Long p_id;

        @SerializedName("price")
        @Property(nameInDb = "price")
        private String price;

        @SerializedName("name")
        @Property(nameInDb = "name")
        private String name;

        //Getters & Setters
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product data) {
        this.product = product;
    }

    //open & total_products Getters & Setters
}

But I don't know what should I write for productConverter.
In other hand, fields in Product class have multiple types. String and Integer.
I read these:
https://github.com/greenrobot/greenDAO/blob/V3.1.1/examples/DaoExample/src/main/java/org/greenrobot/greendao/example/Note.java#L26-L27
http://greenrobot.org/greendao/documentation/custom-types/

A:

It was because of

"GSON Expected BEGIN_ARRAY but was BEGIN_OBJECT"

Should do something like this:  
JsonParser parser = new JsonParser();
JsonObject rootObject = parser.parse(JSON_STRING).getAsJsonObject();
//You can get the "open" and "total_products" here too.//
JsonElement productElement = rootObject.get("product");

Gson gson = new Gson();
List<Product> productList = new ArrayList<>();
//Check if "data" element is an array or an object and parse accordingly...
if (productElement.isJsonObject()) {
//The returned list has only 1 element
Product p = gson.fromJson(productElement, Product.class);
productList.add(p);
}
else if (productElement.isJsonArray()) {
//The returned list has >1 elements
Type productListType = new TypeToken<List<Product>>() {}.getType();
productList = gson.fromJson(productElement, productListType);
}

[ Source: https://stackoverflow.com/a/16656096/421467 ]

