Convert any record to string and vice versa?

How to convert any type of record to one String and vice versa? Perhaps upload a record to a stream and read it as a string? The entries I use will not include any special types: they just use simple things like String , Integer , PChar , DWORD and Array of [String] , etc. And nothing like classes or functions.

This line will be saved in various places, such as a flat text file, a database record sent over the network, etc. The contents of the string can be transferred in other ways between each of them, for example, copying a string from a text file and saving it in a database record. The general idea is that the string will be compatible enough to save anywhere, move it, and load it back to its original state. I understand that I need to understand what type of record and assign it accordingly, and that part in which I do not need help.

+7
source share
1 answer

You can serialize your record using RTTI, here you can use XML, JSON or another format to save the record data.

If you don't want to write your own method for serializing records, try these alternatives.

+7
source

All Articles