I've got an Object I'd like to map to a JSON string with the DMVC-Framework's object mapper with the Delphi Berlin Starter Edition.
TListThing = class
private
FList : TList<string>;
public
property List : TList<String> read FList write FList;
constructor Create;
destructor Destroy;
end;
But when I call Mapper.ObjectToJSONObjectString(ListThing)
I get an invalid typecast, when the Mapper hits the List property.
Setting the attribute [MapperListOf(string)]
List propetry crashes too. Does anyone have a solution for that or is this even a case for a bug report for the project?
As far as I'm concerned, this version of the framework mapper that does not support filling niether TList nor TStringList. It works fine though with TObjectList, where AClass is nothing but a wrapper for your strings.
See description here: https://danieleteti.gitbooks.io/delphimvcframework/content/chapterrenders.html
[MapperListOf(TNested)]
property NestedList: TObjectList<TNested> read FNestedList write SetNestedList;
For serialization and deserialization nested objects and object lists must be created. But can be freed at runtime as we can see further down.