#1 2015-08-19 07:38:18

EgorovAlex
Member
Registered: 2015-02-18
Posts: 43

Aliases for record fields

Hello,

XSuperObject have useful feature: Alias

I can declare

TRec = record
    [ALIAS('I')]  Id:     UInt32; 
    [ALIAS('U')]  UId:    UInt64; 
    [ALIAS('P')]  Parent: UInt32;
    [ALIAS('C')]  Child:  UInt32;
end;

And after this JSON serialization will use this aliases in text representation instead full names of the fields

Have mORMot such functionality, or I should write my own callbacks CustomReader and CustomWriter?

Offline

#2 2015-08-19 10:41:08

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,272
Website

Re: Aliases for record fields

You can specify the field name you want to TTextWriter.RegisterCustomJSONSerializerFromText().

See http://synopse.info/files/html/Synopse% … l#NDX_1361

Offline

Board footer

Powered by FluxBB