JSONMarshalled not working in Delphi
I have the following simple class using Delphi XE7
{$M+}
{$RTTI EXPLICIT FIELDS([vcPrivate])}
TEntityForCreation = class
private
[JSONMarshalled(False)]
FCreator: Integer;
FDescription: String;
public
property Creator: Integer read FCreator write FCreator;
property Description: String read FDescription write FDescription;
function ToJsonString: string;
class function FromJsonString(AJsonString: string): TEntityForCreation;
end;
ToJsonString method uses native JSON serialization
function TEntityForCreation.ToJsonString: string;
begin
result := TJson.ObjectToJsonString(self);
end;
For some reason, the Creator element is always serialized to a Json string. I have turned on "Emit Runtime Type Information" to "True" in the project options.
While executing the JSON marshalling code, I can see that it simply doesn't recognize that JSONMarshalled is associated with FCreator. I suppose there is some compiler directive missing somewhere, but can't figure it out.
+3
source to share
No one has answered this question yet
See similar questions:
or similar: