#1 2024-02-15 07:12:24

fisipjm
Member
Registered: 2024-02-15
Posts: 1

DeSerialize ans Serialize JSON under Android/iOS with mORMot 1

Hi everyone,

I'm new to mORMot and could use some guidance. Currently, I'm tackling a learning curve big_smile I'm exploring mORMot because I've encountered performance issues with Delphi's TJSON methods when dealing with large datasets (100,000+ objects). After some testing, I was impressed by mORMot 2's performance (55ms vs. 10,000ms+). However, my project involves Android and iOS clients, so I looked into SynCrossPlatformJSON.pas.

I attempted to parse my existing structure using the mentioned component but encountered difficulties. The object isn't populated, and JSON isn't generated. Here's a snippet of the class I'm working with:

type
  TArrayClass<T: Class> = class
  private
    fObjects: TArray<T>;
  published
    property Objects: TArray<T> read fObjects write fObjects;
  end;

  TBaseClass = class
  private
    fValue1: string;
    fValue2: string;
    fValue3: string;
    fValue4: string;
    fValue5: string;
  published
    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;
  published
    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>);

I try to Serialize / Dezerialize the TCompleteList with jsonToObject or ObjectTojson but do not get it to work. Can anybody give me a hint?

Best Regards
PJM

Offline

Board footer

Powered by FluxBB