Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program ConsoleProj;
- {$APPTYPE CONSOLE}
- {$R *.res}
- uses
- MVCFramework,
- MVCFramework.Serializer.Commons,
- MVCFramework.Nullables,
- MVCFramework.Serializer.JsonDataObjects,
- JsonDataObjects;
- type
- {$M+}
- TObjB = class
- private
- FAnInt: integer;
- public
- property AnInt: integer read FAnInt write FAnInt;
- end;
- TObjA = class
- private
- FObjB: TObjB;
- FX: NullableString;
- FY: NullableString;
- public
- property Y: NullableString read FY write FY;
- property ObjB: TObjB read FObjB write FObjB;
- property X: NullableString read FX write FX;
- end;
- TObjC = class
- private
- FObjA: TObjA;
- public
- property ObjA: TObjA read FObjA write FObjA;
- end;
- procedure Test;
- var
- s: string;
- lSer: TMVCJsonDataObjectsSerializer;
- j: TJsonObject;
- o,oo: TObjC;
- begin
- s := '{"ObjA": {"Y": null,"ObjB": null,"X": null}}';
- j := TMVCJsonDataObjectsSerializer.ParseObject(s);
- oo := TObjC.Create;
- lSer := TMVCJsonDataObjectsSerializer.Create;
- lSer.JsonObjectToObject(j, oo, stProperties, []);
- if oo = nil then;
- end;
- begin
- Test;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement