I\'m having a problem serializing an object using Gson.
@XmlRootElement class Foo implements Serializable { private int number; private String str;
Instead of hardcoding the type you can do:
... jo.add(Foo.getClass().getSimpleName(), je);