tastelkp.blogg.se

Delphi serialize object to string
Delphi serialize object to string











My class now looks like this: TReplaceField = class

Delphi serialize object to string

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.

Delphi serialize object to string

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#).

Delphi serialize object to string

I've searched a lot, but cannot find a working solution.













Delphi serialize object to string