Dear all,
I'm trying to use the Web Core with XData (please note that I have no experience with Web Core).
I have a class in XData service with following structure :
Type
TCustomers = class;
TCustomerBranch = class;
TCustomerUsers = class;
TCustomers = Class
private
FID: Integer;
FName: string;
FBranchList: TObjectList< TCustomerBranch>;
public
constructor Create;
destructor Destroy; override;
published
property ID: Integer read FID write FID;
property Name: string read FName write FName;
property BranchList: TObjectList< TCustomerBranch > read FBranchList write FBranchList;
end;
TCustomerBranch = Class
private
FID: Integer;
FStreet: string;
FUsersList: TObjectList< TCustomerUsers >;
public
constructor Create;
destructor Destroy; override;
published
property ID: Integer read FID write FID;
property Street: string read FStreet write FStreet;
property FUsersList: TObjectList< TCustomerUsers > read FUsersList write FUsersList;
end;
TCustomerUsers = Class
private
FID: Integer;
FUserName: string;
public
published
property ID: Integer read FID write FID;
property UserName: string read FUserName write FUserName;
end;
The XData service returns the following structure :
{ "$id": 1,
"@xdata.type": "AppEntitiesWeb.TCustomers",
"ID": 0,
"Name": "CUSTOMER NAME",
"BranchList": [
{ "$id": 2,
"@xdata.type": "AppEntitiesWeb.TCustomerBranch ",
"ID": 0,
"Street": "Some Street",
"UsersList": [
{ "$id": 3,
"@xdata.type": "AppEntitiesWeb.TCustomerUsers",
"ID": 0,
"UserName": "Some User Name" } ] } ] }
Is there any way to deserialize the above Class TCustomers from XData to Web core as
VCL (e.g. : ACustomer := TJson.Deserialize< TCustomers >(JSONStr) ) ?
If not, is there a similar example I can use?
Thank you in advance!