let's say i have two objects: Person and ReqSingUp, and ReqSingUp contains Person.
Now if i try:
Person p=new Person("dan","lala");
ReqSingUp reqSingUp=new ReqSingUp(p);
String s = gson.toJson(reqSingUp,ReqSingUp.class);
Object o = gson.fromJson(s, Object.class);
if (o instanceof ReqSingUp) {
System.out.println("it's ReqSingUp");
}
if (o instanceof Person ) {
System.out.println("it's person");
}
it does not satisfy any condition (not instanceof ReqSingUp
and not instanceof Person
).
Is there a way to know which type it is?
Thanks in advance.