You are not logged in.
Pages: 1
I've noticed that records with variant parts are fully serialzed with RecordSaveJson, example is TRect.
var
Temp: RawUtf8;
R: TRect;
begin
R := Rect(50, 50, 100, 100);
Temp := RecordSaveJSON(R, TypeInfo(TRect));
ShowMessage(Temp);
end;
Result is: {"Left":50,"Top":50,"Right":100,"Bottom":100,"TopLeft":{"X":50,"Y":50},"BottomRight":{"X":100,"Y":100}}
All values are correct of course but TopLeft and BottomRight parts are not needed, if there's an easy way to recognize variant parts in records solution would be to only use first part.
Offline
> Define text serialization of the record with only the needed fields.
Text serialization works but it's easier to rely on RTTI for the job. Have you tried to see if that's possible, that is detect record has variant definition? If not I can add it to my ToDo list and try to find a solution at some point.
Offline
Pages: 1