Invalid class typecast for property "x" [Expected: TArray<System.string>, Actual: Array]
AlbertSchimidt opened this issue · comments
Hello again!
I've been using DMVC for a little long time now, and it works great.
But now I'm having trouble with TArray class. Like in the sample "renders" provided from the samples.zip, I can SERIALIZE an TArray<System.string> just fine, but I cannot seem to DESERIALIZE an json array. Always getting the same error "Invalid class typecast for property "x" [Expected: TArray<System.string>, Actual: Array]".
My json array is like this:
{
"myProp": [
"Test1",
"Test2"
]
}
It's the same array generated by the Render method.
My class is like this:
TMyClass = class
private
FMyProp: TArray<string>;
public
property myProp: TArray<string> read FMyProp write FMyProp
end;
Trying to DESERIALIZE like this:
var
oMyClass: TMyClass;
oMyClass := Context.Request.BodyAs<TMyClass>; // raises "Invalid class typecast for property "x" [Expected: TArray<System.string>, Actual: Array]" error
What I'm doing wrong?