RaelB 4 Posted December 11, 2021 Is using "TJSON.ObjectToJsonObject" to convert an object into a TJSONValue (and ultimately into a string). Is it possible for this conversion to leave out a specific field/fields, for e.g. using some type of attribute? For example: TPersistItem = class(TPersistent) private FChangeStatus: TChangeStatus; FId: Variant; FLoading: Boolean; procedure SetId(const Value: Variant); protected ... procedure SetChangeStatus(const Value: TChangeStatus); public ... published property ChangeStatus: TChangeStatus read FChangeStatus write SetChangeStatus; property Id: Variant read FId write SetId; end; I don't want fields "ChangeStatus" and "Loading" to be included in the result. Thanks Share this post Link to post
Uwe Raabe 2057 Posted December 11, 2021 The attribute you are looking for is JSONMarshalled: TPersistItem = class(TPersistent) private [JSONMarshalled(False)] FChangeStatus: TChangeStatus; FId: Variant; [JSONMarshalled(False)] FLoading: Boolean; procedure SetId(const Value: Variant); protected Make sure to have REST.Json.Types in your uses clause. Share this post Link to post