Domain classes should only be associated with business logic, and not with persistence or serialization.
You need to create a set of Data Transfer Object (DTO) classes, each of which corresponds to one of the domain classes. These classes will only contain properties from the domain classes that you decide to open. This allows domain classes to have properties that are not displayed through your persistence or serialization levels.
DTO objects will be serialized and deserialized.
Then it will be convenient for you to create static "translate" methods for translation between the domain and DTO objects.
source
share