Using Jackson we have the option to attach the type info to the serialized object (http://jackson.codehaus.org/1.5.5/javadoc/org/codehaus/jackson/annotate/JsonTypeInfo.html).
Is there a way to do this using GSON like:
{
propertyName:"test",
_className:"foo.bar.TestClass"
}
The idea is to have it generic, so when a ArrayList<Object>
is deserialized, the right object instances are restored with it.
I saw this question: https://stackoverflow.com/a/8683689/1001027 that is more or less what I need but it works just for a specific class of objects. How could implement is in such a generic way, that every object would be serialized with this property?