You are not logged in.
Hello,
I am using Delphi 7 and latest available version of Synopse from GitHub. Just removed all SynCommons.pas files from my system and have just a single copy.
Registering a custom json text writer fails for me. Details are as following:
type
TTicker = packed record
symbol: RawUTF8;
highPrice: Double;
lowPrice: Double;
end;
TTickers = Array of TTicker;
const
__TTickers = '[symbol RawUTF8 highPrice Double lowPrice Double]';
initialization
TTextWriter.RegisterCustomJSONSerializerFromText(TypeInfo(TTickers), __TTickers);
end;
I am getting error saying:
TTicker text definition is not accurate, or the type has not been defined as packed record: RTTI size is 20 bytes but text definition covers 0 bytes
I cannot see where I am doing it wrong.
Any help is appreciated.
Thanks & regards,
Ertan
Offline
Try
__TTickers = 'symbol:RawUTF8 highPrice,lowPrice:Double';
The embrassing [ ] are not meant to be there - they are allowed only for nested arrays.
Please check the docs and samples.
Offline
Missed that point in samples.
Thanks for clarifying.
Offline