Deserializing Json to TROComplextype - howto

Hi there, searching the web, your wiki and others but did not find that one.

Given a (remobjects) rest server which does serialize an Array of this:

  TPhoneBookContact = class(TROComplexType)
    FId: Integer;
    FParentBexioId: Integer;
    FLastUpdate: TDateTime;
    FLastName: Routf8String;
    FSurName: Routf8String;
    FPhone01: Routf8String;
    FPhone02: Routf8String;
    FPhone03: Routf8String;
    FEmail: Routf8String;
    constructor Create;
    property Id: Integer read Id write FId;
    property ParentId: Integer read FParentId write FParentId;
    property LastUpdate: TDateTime read FLastUpdate write FLastUpdate;
    {$IFDEF RO_RTTI_Support} [ROSerializeAsUTF8String] {$ENDIF}
    property LastName: Routf8String read FLastName write FLastName;
    {$IFDEF RO_RTTI_Support} [ROSerializeAsUTF8String] {$ENDIF}
    property SurName: Routf8String read FSurName write FSurName;
    {$IFDEF RO_RTTI_Support} [ROSerializeAsUTF8String] {$ENDIF}
    property Phone01: Routf8String read FPhone01 write FPhone01;
    {$IFDEF RO_RTTI_Support} [ROSerializeAsUTF8String] {$ENDIF}
    property Phone02: Routf8String read FPhone02 write FPhone02;
    {$IFDEF RO_RTTI_Support} [ROSerializeAsUTF8String] {$ENDIF}
    property Phone03: Routf8String read FPhone03 write FPhone03;
    {$IFDEF RO_RTTI_Support} [ROSerializeAsUTF8String] {$ENDIF}
    property Email: Routf8String read FEmail write FEmail;


The server does it magically through a TROJsonMessage with HttpApiDispatcher and so on.

Simple question: How would deserialize a delphi client the generated json back to a TROArray? I would appreciate a small example. Thanks!


Import your RODL from Code-First service with Service Builder: EditImportImport Remoting SDK service (RODL)...

if you generate _Intf, you can see something like

function TNewService_Proxy.NewMethod: NewArray;
    lMessage.Read('Result', System.TypeInfo(NewArray), lResult, []); //<<<<<<<

code inside this line calls NewArray.ReadComplex so you can read array manually