I have the following
public class Zoo{
  int id;
  String name;
  List<Animal> animalList;
  List<Bathroom> bathrooms;
}
public interface Animal{
  //animal has some common methods, but is mostly for naming
}
public class Cat implement Animal{
  int legs;//4
  String language;//meow
  String name;// owner
}
public class Horse implements Animal{
  String name;
  String owner;
  List<Race> races;//list of races this horse is scheduled to run
}
And I have many more types of Animals that do completely different things from each other.
Now the problem is when I try to covert a Zoo object to json, the animal blocks are there but completely empty: no data. How do I solve this problem?
conversion code
Zoo zoo = createCompleteZooObject();
Gson gson = new Gson();
String json = gson.toJson(zoo);
System.out.println(json)
Notice that I have no problem getting the list of bathrooms List<Bathroom> bathrooms as Json. Only the Animal (since it's an interface) is not showing up.