Is there a generic way to skip field serialization at JSON marshalling in Delphi XE2 DataSnap ?
TBizObjects = class
DataObject: TDataObject; -- skip this field on serializaing descendants
end;
Model = class(TBizObject);
Is there a generic way to skip field serialization at JSON marshalling in Delphi XE2 DataSnap ?
TBizObjects = class
DataObject: TDataObject; -- skip this field on serializaing descendants
end;
Model = class(TBizObject);
The solution is quite easy but very well hidden. You should set the
JSONMarshalled
class attribute to False for fields you don't want to serialize or deserialize.Assume you have declared the following class you want to marshal:
In this declaration, only
FName
andFHeight
will be serialized and deserialized, theFSurname
will be omitted:Here you have some code to play with: