Is it possible to programmatically set that you want to exclude a property from serialization?

Example:

* When de-serializing, I want to load up an ID field
* When serializing, I want to NOT output the ID field