Einzelnen Beitrag anzeigen

fisipjm

Registriert seit: 28. Okt 2013
251 Beiträge
 
#3

AW: TJSONToObject Performance

  Alt 13. Feb 2024, 07:22
Moin Olli,

die Klasse sieht so aus:

Delphi-Quellcode:
type
TArrayClass<T: Class> = class
    private
        fObjects: TArray<T>;
    public
        property Objects: TArray<T> read fObjects write fObjects;
    end;


 TBaseClass = class
    private
        fValue1: string;
        fValue2: string;
        fValue3: string;
        fValue4: string;
        fValue5: string;
    public
        property Value1: string read fValue1 write fValue1;
        property Value2: string read fValue2 write fValue2;
        property Value3: string read fValue3 write fValue3;
        property Value4: string read fValue4 write fValue4;
        property Value5: string read fValue5 write fValue5;
    end;

TExtenderClass = class(TBaseClass)
    private
        fValue6: string;
        fValue7: string;
        fValue8: string;
        fValue9: string;
    public
        property Value6: string read fValue6 write fValue6;
        property Value7: string read fValue7 write fValue7;
        property Value8: string read fValue8 write fValue8;
        property Value9: string read fValue9 write fValue9;
    end;

TCompleteList = class(TArrayClass<TExtenderClass>);

....
var
  lList: TCompleteList;
...

  lList:= TJson.JsonToObject<TCompleteList>(MyJSONString);
...
  Mit Zitat antworten Zitat