When in Rome, do as the Romans do - Part III
In Delphi, properties can be backed by simple fields, but they can also have getter and setter functions that can be vital to the proper functioning of a class. They can contain additional initialization code, protect the consistency of the object's data, prevent invalid input...
As you might guess, field-based serialization does not call the appropriate getters and setters, and can cause runtime malfunctions. On the other hand, property-based serialization calls getters and setters if any exist.
This is another thing to consider when using
REST.Json, which uses field
serialization instead of property serialization.
- REST.JSON ignores property setters https://quality.embarcadero.com/browse/RSP-26262