You are not logged in.
Hi, (latest Mormot and Rio 10.3.2)
Whe we use record in property:
TAllParkDeviceConfiguration = packed record
DeviceID: Integer;
IP: RawUTF8;
PORT: Integer;
MODE: Integer;
BAR_CLOSE: Integer;
TIM_ZAP_CLOSE: Integer;
TIMEOUT_PREHOD: Integer;
TIMEOUT_ISVALID: Integer;
TRIGER_LPR: Integer;
TIMEOUT_LPR: Integer;
PROVIDER: Integer;
GSM_SERVICE: RawUTF8;
end;
property MyRecord:TAllParkDeviceConfiguration read getMyRecord write setMyRecord;
it throws : Invalid TJSONSerializer.AddRecordJSON(41541b0e).
But if I use:
property MyRecord:TAllParkDeviceConfiguration read fMyRecord write fMyRecord ;
We need this because we use Interfaces where get and set have to be defined.
Thank you,
Vojko
Offline
The property is from a class?
Record properties are not fully supported yet, since it is something not very stable in Delphi compilers, and not supported in FPC.
Any input is welcome.
As a workaround, you can define a variant published property, then return a TDocVariant content from the record for proper serialization.
Or a RawJSON published property - which may be even a bit more efficient.
Those types would support getters and setters.
Online
I implemented published string property and use RecordSaveJSON and RecordLoadJSON.
Worka perfectly, Thank you
Offline