Property Key : string read FKey write FKey My class now looks like this: TReplaceField = class Also deserialization of one object works, but not deserialization of a collection. With the tips from David, I've got the serialization working. I'm pretty stuck on how to do it in Delphi (besides creating JSON by hand via string concatenation). In C#, all of this is pretty easy, like a few lines of code. Type tkPointer is not currently supported When I use a TList at runtime, I get a different error: I've found REST.JSON and TJson.ObjectToJsonString(), which works good for 1 object.īut if I pass an array of TReplaceField, it gives me a compile error:Į2010 Incompatible types: 'TObject' and 'Dynamic array' I want to create a collection of it, be it an array, TList, or whatever suits best in this case, and then serialize it to JSON (to store it) and later deserialze it to loop over the fields. I have a unit with the following class declaration: TReplaceField = classĬonstructor Create(strKey, strValue: string) overload Ĭlass can also be record, like suggested in the comment. Most likely because I'm pretty new to Delphi (and coming from C#). I've searched a lot, but cannot find a working solution.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2023
Categories |