I have an object eg.:
TFoo = class(TObject)
private
FConnection : TADOConnection;
public
FName : string;
FSurname : string;
end;
i convert this object in a json string with ObjectToJsonString
, eg.:
uses REST.Json;
// ...
var
aFoo : TFoo;
begin
aFoo := TFoo.create;
Memo1.lines.text := TJson.ObjectToJsonString(aFoo);
aFoo.free;
end;
TJson.ObjectToJsonString
make a json string with both private and public variables.
i want exclude some variable like FConnection
from the json string (it expose also the connection string).
Any suggestion for allow the json conversion only on the public variable?