I have following structure of class
public class A{
public class C{
//some variable
}
public class D{
// some variable
}
public class B{
public string var1; public string var2;
public C objC;
public D objD;
}
public static A.B parse(string jsonToParse){
return (A.B) System.JSON.deserialize)(jsonToParse, A.class)
}
}
When the parse method is called , I am getting error System.TypeException: Invalid conversion from runtime type A to A.B
The JSON that is passed to parse method is according to B's structure. What went wrong with this code?
Any help is appreciated and thanks in advance :-)