You are not logged in.
Pages: 1
Are there any conditional defines that must be set for Delphi 7? I noticed that the results for TDocVariantData.ToJSON() differs between Delphi 7 and XE3.
Sample code:
procedure TForm1.FormCreate(Sender: TObject);
type
TListItem = record
Name: string;
Value: integer;
end;
TListItems = Array of TListItem;
var
Source: TDocVariantData;
Data: TListItems;
DataStr: RawUtf8;
begin
SetLength(Data, 2);
Data[0].Name := 'Name1'; Data[0].Value := 0;
Data[1].Name := 'Name2'; Data[1].Value := 1;
Source.InitFromTypeInfo(Data, TypeInfo(TListItems), true, []);
DataStr := source.ToJSON();
Memo1.Lines.Add(DataStr);
end;
In XE3, this produces:
[{"Name":"Name1","Value":0},{"Name":"Name2","Value":1}]
In Delphi 7, this produces:
["Name1",""]
Offline
You need to register the record information with text, since there is no RTTI for records in Delphi 7.
See https://synopse.info/files/html/Synopse … #TITLE_234
and the record should be marked as "packed".
Offline
Pages: 1